From cf0a9e43419434999fe47b950e74b3659ce634fe Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 4 Aug 2021 18:50:46 +0000 Subject: [PATCH 1/2] fix: fix validation result docs feat: add language code to streaming recognition result docs: update environment docs PiperOrigin-RevId: 388737005 Source-Link: https://github.com/googleapis/googleapis/commit/8dfb2156b61a0105b796cc76c657df392f1d091c Source-Link: https://github.com/googleapis/googleapis-gen/commit/ba1df8db76e0556d504809df957d9ec6ba598498 --- owl-bot-staging/v2/.eslintignore | 6 + owl-bot-staging/v2/.eslintrc.json | 3 + owl-bot-staging/v2/.gitignore | 14 + owl-bot-staging/v2/.jsdoc.js | 55 + owl-bot-staging/v2/.mocharc.js | 33 + owl-bot-staging/v2/.prettierrc.js | 22 + owl-bot-staging/v2/README.md | 1 + owl-bot-staging/v2/linkinator.config.json | 10 + owl-bot-staging/v2/package.json | 78 + .../google/cloud/dialogflow/v2/agent.proto | 506 +++ .../cloud/dialogflow/v2/answer_record.proto | 292 ++ .../cloud/dialogflow/v2/audio_config.proto | 372 ++ .../google/cloud/dialogflow/v2/context.proto | 331 ++ .../cloud/dialogflow/v2/conversation.proto | 358 ++ .../dialogflow/v2/conversation_event.proto | 86 + .../dialogflow/v2/conversation_profile.proto | 594 +++ .../google/cloud/dialogflow/v2/document.proto | 410 +++ .../cloud/dialogflow/v2/entity_type.proto | 569 +++ .../cloud/dialogflow/v2/environment.proto | 390 ++ .../cloud/dialogflow/v2/fulfillment.proto | 174 + .../google/cloud/dialogflow/v2/gcs.proto | 28 + .../v2/human_agent_assistant_event.proto | 44 + .../google/cloud/dialogflow/v2/intent.proto | 1097 ++++++ .../cloud/dialogflow/v2/knowledge_base.proto | 234 ++ .../cloud/dialogflow/v2/participant.proto | 611 ++++ .../google/cloud/dialogflow/v2/session.proto | 672 ++++ .../dialogflow/v2/session_entity_type.proto | 313 ++ .../dialogflow/v2/validation_result.proto | 76 + .../google/cloud/dialogflow/v2/version.proto | 267 ++ .../google/cloud/dialogflow/v2/webhook.proto | 145 + owl-bot-staging/v2/src/index.ts | 53 + owl-bot-staging/v2/src/v2/agents_client.ts | 3085 ++++++++++++++++ .../v2/src/v2/agents_client_config.json | 74 + .../v2/src/v2/agents_proto_list.json | 23 + .../v2/src/v2/answer_records_client.ts | 2408 ++++++++++++ .../src/v2/answer_records_client_config.json | 39 + .../v2/src/v2/answer_records_proto_list.json | 23 + owl-bot-staging/v2/src/v2/contexts_client.ts | 2730 ++++++++++++++ .../v2/src/v2/contexts_client_config.json | 59 + .../v2/src/v2/contexts_proto_list.json | 23 + .../v2/src/v2/conversation_profiles_client.ts | 2599 +++++++++++++ .../conversation_profiles_client_config.json | 54 + .../v2/conversation_profiles_proto_list.json | 23 + .../v2/src/v2/conversations_client.ts | 2818 ++++++++++++++ .../src/v2/conversations_client_config.json | 54 + .../v2/src/v2/conversations_proto_list.json | 23 + owl-bot-staging/v2/src/v2/documents_client.ts | 2838 ++++++++++++++ .../v2/src/v2/documents_client_config.json | 59 + .../v2/src/v2/documents_proto_list.json | 23 + .../v2/src/v2/entity_types_client.ts | 3242 ++++++++++++++++ .../v2/src/v2/entity_types_client_config.json | 79 + .../v2/src/v2/entity_types_proto_list.json | 23 + .../v2/src/v2/environments_client.ts | 2832 ++++++++++++++ .../v2/src/v2/environments_client_config.json | 59 + .../v2/src/v2/environments_proto_list.json | 23 + .../v2/src/v2/fulfillments_client.ts | 2226 +++++++++++ .../v2/src/v2/fulfillments_client_config.json | 39 + .../v2/src/v2/fulfillments_proto_list.json | 23 + owl-bot-staging/v2/src/v2/gapic_metadata.json | 1094 ++++++ owl-bot-staging/v2/src/v2/index.ts | 33 + owl-bot-staging/v2/src/v2/intents_client.ts | 2927 +++++++++++++++ .../v2/src/v2/intents_client_config.json | 64 + .../v2/src/v2/intents_proto_list.json | 23 + .../v2/src/v2/knowledge_bases_client.ts | 2596 +++++++++++++ .../src/v2/knowledge_bases_client_config.json | 54 + .../v2/src/v2/knowledge_bases_proto_list.json | 23 + .../v2/src/v2/participants_client.ts | 2784 ++++++++++++++ .../v2/src/v2/participants_client_config.json | 64 + .../v2/src/v2/participants_proto_list.json | 23 + .../v2/src/v2/session_entity_types_client.ts | 2677 ++++++++++++++ .../session_entity_types_client_config.json | 54 + .../v2/session_entity_types_proto_list.json | 23 + owl-bot-staging/v2/src/v2/sessions_client.ts | 2476 +++++++++++++ .../v2/src/v2/sessions_client_config.json | 39 + .../v2/src/v2/sessions_proto_list.json | 23 + owl-bot-staging/v2/src/v2/versions_client.ts | 2620 +++++++++++++ .../v2/src/v2/versions_client_config.json | 54 + .../v2/src/v2/versions_proto_list.json | 23 + .../system-test/fixtures/sample/src/index.js | 41 + .../system-test/fixtures/sample/src/index.ts | 116 + owl-bot-staging/v2/system-test/install.ts | 49 + owl-bot-staging/v2/test/gapic_agents_v2.ts | 2926 +++++++++++++++ .../v2/test/gapic_answer_records_v2.ts | 2082 +++++++++++ owl-bot-staging/v2/test/gapic_contexts_v2.ts | 2456 +++++++++++++ .../v2/test/gapic_conversation_profiles_v2.ts | 2334 ++++++++++++ .../v2/test/gapic_conversations_v2.ts | 2470 +++++++++++++ owl-bot-staging/v2/test/gapic_documents_v2.ts | 2675 ++++++++++++++ .../v2/test/gapic_entity_types_v2.ts | 3070 ++++++++++++++++ .../v2/test/gapic_environments_v2.ts | 2557 +++++++++++++ .../v2/test/gapic_fulfillments_v2.ts | 1866 ++++++++++ owl-bot-staging/v2/test/gapic_intents_v2.ts | 2638 ++++++++++++++ .../v2/test/gapic_knowledge_bases_v2.ts | 2334 ++++++++++++ .../v2/test/gapic_participants_v2.ts | 2502 +++++++++++++ .../v2/test/gapic_session_entity_types_v2.ts | 2372 ++++++++++++ owl-bot-staging/v2/test/gapic_sessions_v2.ts | 2046 +++++++++++ owl-bot-staging/v2/test/gapic_versions_v2.ts | 2334 ++++++++++++ owl-bot-staging/v2/tsconfig.json | 19 + owl-bot-staging/v2/webpack.config.js | 64 + owl-bot-staging/v2beta1/.eslintignore | 6 + owl-bot-staging/v2beta1/.eslintrc.json | 3 + owl-bot-staging/v2beta1/.gitignore | 14 + owl-bot-staging/v2beta1/.jsdoc.js | 55 + owl-bot-staging/v2beta1/.mocharc.js | 33 + owl-bot-staging/v2beta1/.prettierrc.js | 22 + owl-bot-staging/v2beta1/README.md | 1 + .../v2beta1/linkinator.config.json | 10 + owl-bot-staging/v2beta1/package.json | 78 + .../cloud/dialogflow/v2beta1/agent.proto | 519 +++ .../dialogflow/v2beta1/answer_record.proto | 317 ++ .../dialogflow/v2beta1/audio_config.proto | 437 +++ .../cloud/dialogflow/v2beta1/context.proto | 375 ++ .../dialogflow/v2beta1/conversation.proto | 419 +++ .../v2beta1/conversation_event.proto | 82 + .../v2beta1/conversation_profile.proto | 581 +++ .../cloud/dialogflow/v2beta1/document.proto | 533 +++ .../dialogflow/v2beta1/entity_type.proto | 571 +++ .../dialogflow/v2beta1/environment.proto | 367 ++ .../dialogflow/v2beta1/fulfillment.proto | 176 + .../google/cloud/dialogflow/v2beta1/gcs.proto | 46 + .../v2beta1/human_agent_assistant_event.proto | 51 + .../cloud/dialogflow/v2beta1/intent.proto | 1422 ++++++++ .../dialogflow/v2beta1/knowledge_base.proto | 278 ++ .../dialogflow/v2beta1/participant.proto | 1062 ++++++ .../cloud/dialogflow/v2beta1/session.proto | 812 +++++ .../v2beta1/session_entity_type.proto | 351 ++ .../v2beta1/validation_result.proto | 76 + .../cloud/dialogflow/v2beta1/version.proto | 261 ++ .../cloud/dialogflow/v2beta1/webhook.proto | 165 + owl-bot-staging/v2beta1/src/index.ts | 53 + .../v2beta1/src/v2beta1/agents_client.ts | 3088 ++++++++++++++++ .../src/v2beta1/agents_client_config.json | 74 + .../src/v2beta1/agents_proto_list.json | 23 + .../src/v2beta1/answer_records_client.ts | 2463 +++++++++++++ .../v2beta1/answer_records_client_config.json | 44 + .../v2beta1/answer_records_proto_list.json | 23 + .../v2beta1/src/v2beta1/contexts_client.ts | 2781 ++++++++++++++ .../src/v2beta1/contexts_client_config.json | 59 + .../src/v2beta1/contexts_proto_list.json | 23 + .../v2beta1/conversation_profiles_client.ts | 2599 +++++++++++++ .../conversation_profiles_client_config.json | 54 + .../conversation_profiles_proto_list.json | 23 + .../src/v2beta1/conversations_client.ts | 2896 +++++++++++++++ .../v2beta1/conversations_client_config.json | 59 + .../src/v2beta1/conversations_proto_list.json | 23 + .../v2beta1/src/v2beta1/documents_client.ts | 3032 +++++++++++++++ .../src/v2beta1/documents_client_config.json | 64 + .../src/v2beta1/documents_proto_list.json | 23 + .../src/v2beta1/entity_types_client.ts | 3244 +++++++++++++++++ .../v2beta1/entity_types_client_config.json | 79 + .../src/v2beta1/entity_types_proto_list.json | 23 + .../src/v2beta1/environments_client.ts | 2813 ++++++++++++++ .../v2beta1/environments_client_config.json | 59 + .../src/v2beta1/environments_proto_list.json | 23 + .../src/v2beta1/fulfillments_client.ts | 2228 +++++++++++ .../v2beta1/fulfillments_client_config.json | 39 + .../src/v2beta1/fulfillments_proto_list.json | 23 + .../v2beta1/src/v2beta1/gapic_metadata.json | 1158 ++++++ owl-bot-staging/v2beta1/src/v2beta1/index.ts | 33 + .../v2beta1/src/v2beta1/intents_client.ts | 2925 +++++++++++++++ .../src/v2beta1/intents_client_config.json | 64 + .../src/v2beta1/intents_proto_list.json | 23 + .../src/v2beta1/knowledge_bases_client.ts | 2692 ++++++++++++++ .../knowledge_bases_client_config.json | 54 + .../v2beta1/knowledge_bases_proto_list.json | 23 + .../src/v2beta1/participants_client.ts | 3221 ++++++++++++++++ .../v2beta1/participants_client_config.json | 79 + .../src/v2beta1/participants_proto_list.json | 23 + .../v2beta1/session_entity_types_client.ts | 2724 ++++++++++++++ .../session_entity_types_client_config.json | 54 + .../session_entity_types_proto_list.json | 23 + .../v2beta1/src/v2beta1/sessions_client.ts | 2482 +++++++++++++ .../src/v2beta1/sessions_client_config.json | 39 + .../src/v2beta1/sessions_proto_list.json | 23 + .../v2beta1/src/v2beta1/versions_client.ts | 2613 +++++++++++++ .../src/v2beta1/versions_client_config.json | 54 + .../src/v2beta1/versions_proto_list.json | 23 + .../system-test/fixtures/sample/src/index.js | 41 + .../system-test/fixtures/sample/src/index.ts | 116 + .../v2beta1/system-test/install.ts | 49 + .../v2beta1/test/gapic_agents_v2beta1.ts | 2926 +++++++++++++++ .../test/gapic_answer_records_v2beta1.ts | 2172 +++++++++++ .../v2beta1/test/gapic_contexts_v2beta1.ts | 2456 +++++++++++++ .../gapic_conversation_profiles_v2beta1.ts | 2334 ++++++++++++ .../test/gapic_conversations_v2beta1.ts | 2554 +++++++++++++ .../v2beta1/test/gapic_documents_v2beta1.ts | 2819 ++++++++++++++ .../test/gapic_entity_types_v2beta1.ts | 3070 ++++++++++++++++ .../test/gapic_environments_v2beta1.ts | 2557 +++++++++++++ .../test/gapic_fulfillments_v2beta1.ts | 1866 ++++++++++ .../v2beta1/test/gapic_intents_v2beta1.ts | 2638 ++++++++++++++ .../test/gapic_knowledge_bases_v2beta1.ts | 2334 ++++++++++++ .../test/gapic_participants_v2beta1.ts | 2913 +++++++++++++++ .../gapic_session_entity_types_v2beta1.ts | 2372 ++++++++++++ .../v2beta1/test/gapic_sessions_v2beta1.ts | 2046 +++++++++++ .../v2beta1/test/gapic_versions_v2beta1.ts | 2334 ++++++++++++ owl-bot-staging/v2beta1/tsconfig.json | 19 + owl-bot-staging/v2beta1/webpack.config.js | 64 + 196 files changed, 179038 insertions(+) create mode 100644 owl-bot-staging/v2/.eslintignore create mode 100644 owl-bot-staging/v2/.eslintrc.json create mode 100644 owl-bot-staging/v2/.gitignore create mode 100644 owl-bot-staging/v2/.jsdoc.js create mode 100644 owl-bot-staging/v2/.mocharc.js create mode 100644 owl-bot-staging/v2/.prettierrc.js create mode 100644 owl-bot-staging/v2/README.md create mode 100644 owl-bot-staging/v2/linkinator.config.json create mode 100644 owl-bot-staging/v2/package.json create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/agent.proto create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/answer_record.proto create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/audio_config.proto create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/context.proto create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation.proto create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation_event.proto create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation_profile.proto create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/document.proto create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/entity_type.proto create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/environment.proto create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/fulfillment.proto create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/gcs.proto create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/intent.proto create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/knowledge_base.proto create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/participant.proto create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/session.proto create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/session_entity_type.proto create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/validation_result.proto create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/version.proto create mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/webhook.proto create mode 100644 owl-bot-staging/v2/src/index.ts create mode 100644 owl-bot-staging/v2/src/v2/agents_client.ts create mode 100644 owl-bot-staging/v2/src/v2/agents_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/agents_proto_list.json create mode 100644 owl-bot-staging/v2/src/v2/answer_records_client.ts create mode 100644 owl-bot-staging/v2/src/v2/answer_records_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/answer_records_proto_list.json create mode 100644 owl-bot-staging/v2/src/v2/contexts_client.ts create mode 100644 owl-bot-staging/v2/src/v2/contexts_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/contexts_proto_list.json create mode 100644 owl-bot-staging/v2/src/v2/conversation_profiles_client.ts create mode 100644 owl-bot-staging/v2/src/v2/conversation_profiles_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/conversation_profiles_proto_list.json create mode 100644 owl-bot-staging/v2/src/v2/conversations_client.ts create mode 100644 owl-bot-staging/v2/src/v2/conversations_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/conversations_proto_list.json create mode 100644 owl-bot-staging/v2/src/v2/documents_client.ts create mode 100644 owl-bot-staging/v2/src/v2/documents_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/documents_proto_list.json create mode 100644 owl-bot-staging/v2/src/v2/entity_types_client.ts create mode 100644 owl-bot-staging/v2/src/v2/entity_types_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/entity_types_proto_list.json create mode 100644 owl-bot-staging/v2/src/v2/environments_client.ts create mode 100644 owl-bot-staging/v2/src/v2/environments_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/environments_proto_list.json create mode 100644 owl-bot-staging/v2/src/v2/fulfillments_client.ts create mode 100644 owl-bot-staging/v2/src/v2/fulfillments_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/fulfillments_proto_list.json create mode 100644 owl-bot-staging/v2/src/v2/gapic_metadata.json create mode 100644 owl-bot-staging/v2/src/v2/index.ts create mode 100644 owl-bot-staging/v2/src/v2/intents_client.ts create mode 100644 owl-bot-staging/v2/src/v2/intents_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/intents_proto_list.json create mode 100644 owl-bot-staging/v2/src/v2/knowledge_bases_client.ts create mode 100644 owl-bot-staging/v2/src/v2/knowledge_bases_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/knowledge_bases_proto_list.json create mode 100644 owl-bot-staging/v2/src/v2/participants_client.ts create mode 100644 owl-bot-staging/v2/src/v2/participants_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/participants_proto_list.json create mode 100644 owl-bot-staging/v2/src/v2/session_entity_types_client.ts create mode 100644 owl-bot-staging/v2/src/v2/session_entity_types_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/session_entity_types_proto_list.json create mode 100644 owl-bot-staging/v2/src/v2/sessions_client.ts create mode 100644 owl-bot-staging/v2/src/v2/sessions_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/sessions_proto_list.json create mode 100644 owl-bot-staging/v2/src/v2/versions_client.ts create mode 100644 owl-bot-staging/v2/src/v2/versions_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/versions_proto_list.json create mode 100644 owl-bot-staging/v2/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v2/system-test/install.ts create mode 100644 owl-bot-staging/v2/test/gapic_agents_v2.ts create mode 100644 owl-bot-staging/v2/test/gapic_answer_records_v2.ts create mode 100644 owl-bot-staging/v2/test/gapic_contexts_v2.ts create mode 100644 owl-bot-staging/v2/test/gapic_conversation_profiles_v2.ts create mode 100644 owl-bot-staging/v2/test/gapic_conversations_v2.ts create mode 100644 owl-bot-staging/v2/test/gapic_documents_v2.ts create mode 100644 owl-bot-staging/v2/test/gapic_entity_types_v2.ts create mode 100644 owl-bot-staging/v2/test/gapic_environments_v2.ts create mode 100644 owl-bot-staging/v2/test/gapic_fulfillments_v2.ts create mode 100644 owl-bot-staging/v2/test/gapic_intents_v2.ts create mode 100644 owl-bot-staging/v2/test/gapic_knowledge_bases_v2.ts create mode 100644 owl-bot-staging/v2/test/gapic_participants_v2.ts create mode 100644 owl-bot-staging/v2/test/gapic_session_entity_types_v2.ts create mode 100644 owl-bot-staging/v2/test/gapic_sessions_v2.ts create mode 100644 owl-bot-staging/v2/test/gapic_versions_v2.ts create mode 100644 owl-bot-staging/v2/tsconfig.json create mode 100644 owl-bot-staging/v2/webpack.config.js create mode 100644 owl-bot-staging/v2beta1/.eslintignore create mode 100644 owl-bot-staging/v2beta1/.eslintrc.json create mode 100644 owl-bot-staging/v2beta1/.gitignore create mode 100644 owl-bot-staging/v2beta1/.jsdoc.js create mode 100644 owl-bot-staging/v2beta1/.mocharc.js create mode 100644 owl-bot-staging/v2beta1/.prettierrc.js create mode 100644 owl-bot-staging/v2beta1/README.md create mode 100644 owl-bot-staging/v2beta1/linkinator.config.json create mode 100644 owl-bot-staging/v2beta1/package.json create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/agent.proto create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/answer_record.proto create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/audio_config.proto create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/context.proto create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation.proto create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_event.proto create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/document.proto create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/entity_type.proto create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/environment.proto create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/fulfillment.proto create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/gcs.proto create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/intent.proto create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/participant.proto create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/session.proto create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/validation_result.proto create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/version.proto create mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/webhook.proto create mode 100644 owl-bot-staging/v2beta1/src/index.ts create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/agents_client.ts create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/agents_client_config.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/agents_proto_list.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/answer_records_client.ts create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/answer_records_client_config.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/answer_records_proto_list.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/contexts_client.ts create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/contexts_client_config.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/contexts_proto_list.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_client.ts create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_client_config.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_proto_list.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/conversations_client.ts create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/conversations_client_config.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/conversations_proto_list.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/documents_client.ts create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/documents_client_config.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/documents_proto_list.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/entity_types_client.ts create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/entity_types_client_config.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/entity_types_proto_list.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/environments_client.ts create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/environments_client_config.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/environments_proto_list.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/fulfillments_client.ts create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/fulfillments_client_config.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/fulfillments_proto_list.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/gapic_metadata.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/index.ts create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/intents_client.ts create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/intents_client_config.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/intents_proto_list.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_client.ts create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_client_config.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_proto_list.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/participants_client.ts create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/participants_client_config.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/participants_proto_list.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_client.ts create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_client_config.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_proto_list.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/sessions_client.ts create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/sessions_client_config.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/sessions_proto_list.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/versions_client.ts create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/versions_client_config.json create mode 100644 owl-bot-staging/v2beta1/src/v2beta1/versions_proto_list.json create mode 100644 owl-bot-staging/v2beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v2beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v2beta1/system-test/install.ts create mode 100644 owl-bot-staging/v2beta1/test/gapic_agents_v2beta1.ts create mode 100644 owl-bot-staging/v2beta1/test/gapic_answer_records_v2beta1.ts create mode 100644 owl-bot-staging/v2beta1/test/gapic_contexts_v2beta1.ts create mode 100644 owl-bot-staging/v2beta1/test/gapic_conversation_profiles_v2beta1.ts create mode 100644 owl-bot-staging/v2beta1/test/gapic_conversations_v2beta1.ts create mode 100644 owl-bot-staging/v2beta1/test/gapic_documents_v2beta1.ts create mode 100644 owl-bot-staging/v2beta1/test/gapic_entity_types_v2beta1.ts create mode 100644 owl-bot-staging/v2beta1/test/gapic_environments_v2beta1.ts create mode 100644 owl-bot-staging/v2beta1/test/gapic_fulfillments_v2beta1.ts create mode 100644 owl-bot-staging/v2beta1/test/gapic_intents_v2beta1.ts create mode 100644 owl-bot-staging/v2beta1/test/gapic_knowledge_bases_v2beta1.ts create mode 100644 owl-bot-staging/v2beta1/test/gapic_participants_v2beta1.ts create mode 100644 owl-bot-staging/v2beta1/test/gapic_session_entity_types_v2beta1.ts create mode 100644 owl-bot-staging/v2beta1/test/gapic_sessions_v2beta1.ts create mode 100644 owl-bot-staging/v2beta1/test/gapic_versions_v2beta1.ts create mode 100644 owl-bot-staging/v2beta1/tsconfig.json create mode 100644 owl-bot-staging/v2beta1/webpack.config.js diff --git a/owl-bot-staging/v2/.eslintignore b/owl-bot-staging/v2/.eslintignore new file mode 100644 index 00000000..521dc25a --- /dev/null +++ b/owl-bot-staging/v2/.eslintignore @@ -0,0 +1,6 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ diff --git a/owl-bot-staging/v2/.eslintrc.json b/owl-bot-staging/v2/.eslintrc.json new file mode 100644 index 00000000..78215349 --- /dev/null +++ b/owl-bot-staging/v2/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v2/.gitignore b/owl-bot-staging/v2/.gitignore new file mode 100644 index 00000000..5d32b237 --- /dev/null +++ b/owl-bot-staging/v2/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/v2/.jsdoc.js b/owl-bot-staging/v2/.jsdoc.js new file mode 100644 index 00000000..01541b4a --- /dev/null +++ b/owl-bot-staging/v2/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2021 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/dialogflow', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v2/.mocharc.js b/owl-bot-staging/v2/.mocharc.js new file mode 100644 index 00000000..50bc7f79 --- /dev/null +++ b/owl-bot-staging/v2/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v2/.prettierrc.js b/owl-bot-staging/v2/.prettierrc.js new file mode 100644 index 00000000..84f4713a --- /dev/null +++ b/owl-bot-staging/v2/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v2/README.md b/owl-bot-staging/v2/README.md new file mode 100644 index 00000000..f592662a --- /dev/null +++ b/owl-bot-staging/v2/README.md @@ -0,0 +1 @@ +Dialogflow: Nodejs Client diff --git a/owl-bot-staging/v2/linkinator.config.json b/owl-bot-staging/v2/linkinator.config.json new file mode 100644 index 00000000..29a223b6 --- /dev/null +++ b/owl-bot-staging/v2/linkinator.config.json @@ -0,0 +1,10 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io" + ], + "silent": true, + "concurrency": 10 +} diff --git a/owl-bot-staging/v2/package.json b/owl-bot-staging/v2/package.json new file mode 100644 index 00000000..050cef0d --- /dev/null +++ b/owl-bot-staging/v2/package.json @@ -0,0 +1,78 @@ +{ + "name": "@google-cloud/dialogflow", + "version": "0.1.0", + "description": "Dialogflow client for Node.js", + "repository": "googleapis/nodejs-dialogflow", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google dialogflow", + "dialogflow", + "agents", + "answer records", + "contexts", + "conversation profiles", + "conversations", + "documents", + "entity types", + "environments", + "fulfillments", + "intents", + "knowledge bases", + "participants", + "session entity types", + "sessions", + "versions" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^2.19.0" + }, + "devDependencies": { + "@types/mocha": "^9.0.0", + "@types/node": "^14.17.3", + "@types/sinon": "^10.0.2", + "c8": "^7.7.3", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.0", + "jsdoc-region-tag": "^1.1.0", + "linkinator": "^2.13.6", + "mocha": "^9.0.2", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^11.1.1", + "ts-loader": "^9.2.3", + "typescript": "^4.3.4", + "webpack": "^5.39.1", + "webpack-cli": "^4.7.2" + }, + "engines": { + "node": ">=v10.24.0" + } +} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/agent.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/agent.proto new file mode 100644 index 00000000..db1af7ab --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/agent.proto @@ -0,0 +1,506 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/validation_result.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "AgentProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [Agents][google.cloud.dialogflow.v2.Agent]. +service Agents { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Retrieves the specified agent. + rpc GetAgent(GetAgentRequest) returns (Agent) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/agent" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/agent" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Creates/updates the specified agent. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc SetAgent(SetAgentRequest) returns (Agent) { + option (google.api.http) = { + post: "/v2/{agent.parent=projects/*}/agent" + body: "agent" + additional_bindings { + post: "/v2/{agent.parent=projects/*/locations/*}/agent" + body: "agent" + } + }; + option (google.api.method_signature) = "agent"; + } + + // Deletes the specified agent. + rpc DeleteAgent(DeleteAgentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{parent=projects/*}/agent" + additional_bindings { + delete: "/v2/{parent=projects/*/locations/*}/agent" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Returns the list of agents. + // + // Since there is at most one conversational agent per project, this method is + // useful primarily for listing all agents across projects the caller has + // access to. One can achieve that with a wildcard project collection id "-". + // Refer to [List + // Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). + rpc SearchAgents(SearchAgentsRequest) returns (SearchAgentsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/agent:search" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/agent:search" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Trains the specified agent. + // + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc TrainAgent(TrainAgentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/agent:train" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/agent:train" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Exports the specified agent to a ZIP file. + rpc ExportAgent(ExportAgentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/agent:export" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/agent:export" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.dialogflow.v2.ExportAgentResponse" + metadata_type: "google.protobuf.Struct" + }; + } + + // Imports the specified agent from a ZIP file. + // + // Uploads new intents and entity types without deleting the existing ones. + // Intents and entity types with the same name are replaced with the new + // versions from [ImportAgentRequest][google.cloud.dialogflow.v2.ImportAgentRequest]. After the import, the imported draft + // agent will be trained automatically (unless disabled in agent settings). + // However, once the import is done, training may not be completed yet. Please + // call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the operation it returns in order to train + // explicitly. + // + // An operation which tracks when importing is complete. It only tracks + // when the draft agent is updated not when it is done training. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc ImportAgent(ImportAgentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/agent:import" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/agent:import" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Restores the specified agent from a ZIP file. + // + // Replaces the current agent version with a new one. All the intents and + // entity types in the older version are deleted. After the restore, the + // restored draft agent will be trained automatically (unless disabled in + // agent settings). However, once the restore is done, training may not be + // completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the operation it + // returns in order to train explicitly. + // + // An operation which tracks when restoring is complete. It only tracks + // when the draft agent is updated not when it is done training. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc RestoreAgent(RestoreAgentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/agent:restore" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/agent:restore" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Gets agent validation result. Agent validation is performed during + // training time and is updated automatically when training is completed. + rpc GetValidationResult(GetValidationResultRequest) returns (ValidationResult) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/agent/validationResult" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/agent/validationResult" + } + }; + } +} + +// A Dialogflow agent is a virtual agent that handles conversations with your +// end-users. It is a natural language understanding module that understands the +// nuances of human language. Dialogflow translates end-user text or audio +// during a conversation to structured data that your apps and services can +// understand. You design and build a Dialogflow agent to handle the types of +// conversations required for your system. +// +// For more information about agents, see the +// [Agent guide](https://cloud.google.com/dialogflow/docs/agents-overview). +// +message Agent { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Agent" + pattern: "projects/{project}/agent" + pattern: "projects/{project}/locations/{location}/agent" + }; + + // Match mode determines how intents are detected from user queries. + enum MatchMode { + // Not specified. + MATCH_MODE_UNSPECIFIED = 0; + + // Best for agents with a small number of examples in intents and/or wide + // use of templates syntax and composite entities. + MATCH_MODE_HYBRID = 1; + + // Can be used for agents with a large number of examples in intents, + // especially the ones using @sys.any or very large custom entities. + MATCH_MODE_ML_ONLY = 2; + } + + // API version for the agent. + enum ApiVersion { + // Not specified. + API_VERSION_UNSPECIFIED = 0; + + // Legacy V1 API. + API_VERSION_V1 = 1; + + // V2 API. + API_VERSION_V2 = 2; + + // V2beta1 API. + API_VERSION_V2_BETA_1 = 3; + } + + // Represents the agent tier. + enum Tier { + // Not specified. This value should never be used. + TIER_UNSPECIFIED = 0; + + // Standard tier. + TIER_STANDARD = 1; + + // Enterprise tier (Essentials). + TIER_ENTERPRISE = 2; + + // Enterprise tier (Plus). + TIER_ENTERPRISE_PLUS = 3; + } + + // Required. The project of this agent. + // Format: `projects/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The name of this agent. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The default language of the agent as a language tag. See + // [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. This field cannot be + // set by the `Update` method. + string default_language_code = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The list of all languages supported by this agent (except for the + // `default_language_code`). + repeated string supported_language_codes = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The time zone of this agent from the + // [time zone database](https://www.iana.org/time-zones), e.g., + // America/New_York, Europe/Paris. + string time_zone = 5 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The description of this agent. + // The maximum length is 500 characters. If exceeded, the request is rejected. + string description = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The URI of the agent's avatar. + // Avatars are used throughout the Dialogflow console and in the self-hosted + // [Web + // Demo](https://cloud.google.com/dialogflow/docs/integrations/web-demo) + // integration. + string avatar_uri = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Determines whether this agent should log conversation queries. + bool enable_logging = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Determines how intents are detected from user queries. + MatchMode match_mode = 9 [ + deprecated = true, + (google.api.field_behavior) = OPTIONAL + ]; + + // Optional. To filter out false positive results and still get variety in + // matched natural language inputs for your agent, you can tune the machine + // learning classification threshold. If the returned score value is less than + // the threshold value, then a fallback intent will be triggered or, if there + // are no fallback intents defined, no intent will be triggered. The score + // values range from 0.0 (completely uncertain) to 1.0 (completely certain). + // If set to 0.0, the default of 0.3 is used. + float classification_threshold = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. API version displayed in Dialogflow console. If not specified, + // V2 API is assumed. Clients are free to query different service endpoints + // for different API versions. However, bots connectors and webhook calls will + // follow the specified API version. + ApiVersion api_version = 14 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The agent tier. If not specified, TIER_STANDARD is assumed. + Tier tier = 15 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Agents.GetAgent][google.cloud.dialogflow.v2.Agents.GetAgent]. +message GetAgentRequest { + // Required. The project that the agent to fetch is associated with. + // Format: `projects/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; +} + +// The request message for [Agents.SetAgent][google.cloud.dialogflow.v2.Agents.SetAgent]. +message SetAgentRequest { + // Required. The agent to update. + Agent agent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Agents.DeleteAgent][google.cloud.dialogflow.v2.Agents.DeleteAgent]. +message DeleteAgentRequest { + // Required. The project that the agent to delete is associated with. + // Format: `projects/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; +} + +// The request message for [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents]. +message SearchAgentsRequest { + // Required. The project to list agents from. + // Format: `projects/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// The response message for [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents]. +message SearchAgentsResponse { + // The list of agents. There will be a maximum number of items returned based + // on the page_size field in the request. + repeated Agent agents = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [Agents.TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent]. +message TrainAgentRequest { + // Required. The project that the agent to train is associated with. + // Format: `projects/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; +} + +// The request message for [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent]. +message ExportAgentRequest { + // Required. The project that the agent to export is associated with. + // Format: `projects/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Required. The [Google Cloud Storage](https://cloud.google.com/storage/docs/) + // URI to export the agent to. + // The format of this URI must be `gs:///`. + // If left unspecified, the serialized agent is returned inline. + string agent_uri = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The response message for [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent]. +message ExportAgentResponse { + // The exported agent. + oneof agent { + // The URI to a file containing the exported agent. This field is populated + // only if `agent_uri` is specified in `ExportAgentRequest`. + string agent_uri = 1; + + // Zip compressed raw byte content for agent. + bytes agent_content = 2; + } +} + +// The request message for [Agents.ImportAgent][google.cloud.dialogflow.v2.Agents.ImportAgent]. +message ImportAgentRequest { + // Required. The project that the agent to import is associated with. + // Format: `projects/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Required. The agent to import. + oneof agent { + // The URI to a Google Cloud Storage file containing the agent to import. + // Note: The URI must start with "gs://". + string agent_uri = 2; + + // Zip compressed raw byte content for agent. + bytes agent_content = 3; + } +} + +// The request message for [Agents.RestoreAgent][google.cloud.dialogflow.v2.Agents.RestoreAgent]. +message RestoreAgentRequest { + // Required. The project that the agent to restore is associated with. + // Format: `projects/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Required. The agent to restore. + oneof agent { + // The URI to a Google Cloud Storage file containing the agent to restore. + // Note: The URI must start with "gs://". + string agent_uri = 2; + + // Zip compressed raw byte content for agent. + bytes agent_content = 3; + } +} + +// The request message for [Agents.GetValidationResult][google.cloud.dialogflow.v2.Agents.GetValidationResult]. +message GetValidationResultRequest { + // Required. The project that the agent is associated with. + // Format: `projects/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Optional. The language for which you want a validation result. If not + // specified, the agent's default language is used. [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. Note: languages must be enabled in the agent before they can + // be used. + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/answer_record.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/answer_record.proto new file mode 100644 index 00000000..78aba347 --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/answer_record.proto @@ -0,0 +1,292 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/participant.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "AnswerRecordsProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [AnswerRecords][google.cloud.dialogflow.v2.AnswerRecord]. +service AnswerRecords { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all answer records in the specified project in reverse + // chronological order. + rpc ListAnswerRecords(ListAnswerRecordsRequest) returns (ListAnswerRecordsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/answerRecords" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/answerRecords" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Updates the specified answer record. + rpc UpdateAnswerRecord(UpdateAnswerRecordRequest) returns (AnswerRecord) { + option (google.api.http) = { + patch: "/v2/{answer_record.name=projects/*/answerRecords/*}" + body: "answer_record" + additional_bindings { + patch: "/v2/{answer_record.name=projects/*/locations/*/answerRecords/*}" + body: "answer_record" + } + }; + option (google.api.method_signature) = "answer_record,update_mask"; + } +} + +// Answer records are records to manage answer history and feedbacks for +// Dialogflow. +// +// Currently, answer record includes: +// +// - human agent assistant article suggestion +// - human agent assistant faq article +// +// It doesn't include: +// +// - `DetectIntent` intent matching +// - `DetectIntent` knowledge +// +// Answer records are not related to the conversation history in the +// Dialogflow Console. A Record is generated even when the end-user disables +// conversation history in the console. Records are created when there's a human +// agent assistant suggestion generated. +// +// A typical workflow for customers provide feedback to an answer is: +// +// 1. For human agent assistant, customers get suggestion via ListSuggestions +// API. Together with the answers, [AnswerRecord.name][google.cloud.dialogflow.v2.AnswerRecord.name] are returned to the +// customers. +// 2. The customer uses the [AnswerRecord.name][google.cloud.dialogflow.v2.AnswerRecord.name] to call the +// [UpdateAnswerRecord][] method to send feedback about a specific answer +// that they believe is wrong. +message AnswerRecord { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/AnswerRecord" + pattern: "projects/{project}/answerRecords/{answer_record}" + pattern: "projects/{project}/locations/{location}/answerRecords/{answer_record}" + }; + + // The unique identifier of this answer record. + // Format: `projects//locations//answerRecords/`. + string name = 1; + + // Required. The AnswerFeedback for this record. You can set this with + // [AnswerRecords.UpdateAnswerRecord][google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecord] in order to give us feedback about + // this answer. + AnswerFeedback answer_feedback = 2 [(google.api.field_behavior) = REQUIRED]; + + // The record for this answer. + oneof record { + // Output only. The record for human agent assistant. + AgentAssistantRecord agent_assistant_record = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + } +} + +// Request message for [AnswerRecords.ListAnswerRecords][google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords]. +message ListAnswerRecordsRequest { + // Required. The project to list all answer records for in reverse + // chronological order. Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/AnswerRecord" + } + ]; + + // Required. Filters to restrict results to specific answer records. + // Filter on answer record type. Currently predicates on `type` is supported, + // valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`. + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The maximum number of records to return in a single page. + // The server may return fewer records than this. If unspecified, we use 10. + // The maximum is 100. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The + // [ListAnswerRecordsResponse.next_page_token][google.cloud.dialogflow.v2.ListAnswerRecordsResponse.next_page_token] + // value returned from a previous list request used to continue listing on + // the next page. + string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for [AnswerRecords.ListAnswerRecords][google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords]. +message ListAnswerRecordsResponse { + // The list of answer records. + repeated AnswerRecord answer_records = 1; + + // A token to retrieve next page of results. Or empty if there are no more + // results. + // Pass this value in the + // [ListAnswerRecordsRequest.page_token][google.cloud.dialogflow.v2.ListAnswerRecordsRequest.page_token] + // field in the subsequent call to `ListAnswerRecords` method to retrieve the + // next page of results. + string next_page_token = 2; +} + +// Request message for [AnswerRecords.UpdateAnswerRecord][google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecord]. +message UpdateAnswerRecordRequest { + // Required. Answer record to update. + AnswerRecord answer_record = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Represents feedback the customer has about the quality & correctness of a +// certain answer in a conversation. +message AnswerFeedback { + // The correctness level of an answer. + enum CorrectnessLevel { + // Correctness level unspecified. + CORRECTNESS_LEVEL_UNSPECIFIED = 0; + + // Answer is totally wrong. + NOT_CORRECT = 1; + + // Answer is partially correct. + PARTIALLY_CORRECT = 2; + + // Answer is fully correct. + FULLY_CORRECT = 3; + } + + // The correctness level of the specific answer. + CorrectnessLevel correctness_level = 1; + + // Normally, detail feedback is provided when answer is not fully correct. + oneof detail_feedback { + // Detail feedback of agent assist suggestions. + AgentAssistantFeedback agent_assistant_detail_feedback = 2; + } + + // Indicates whether the answer/item was clicked by the human agent + // or not. Default to false. + bool clicked = 3; + + // Time when the answer/item was clicked. + google.protobuf.Timestamp click_time = 5; + + // Indicates whether the answer/item was displayed to the human + // agent in the agent desktop UI. Default to false. + bool displayed = 4; + + // Time when the answer/item was displayed. + google.protobuf.Timestamp display_time = 6; +} + +// Detail feedback of Agent Assist result. +message AgentAssistantFeedback { + // Relevance of an answer. + enum AnswerRelevance { + // Answer relevance unspecified. + ANSWER_RELEVANCE_UNSPECIFIED = 0; + + // Answer is irrelevant to query. + IRRELEVANT = 1; + + // Answer is relevant to query. + RELEVANT = 2; + } + + // Correctness of document. + enum DocumentCorrectness { + // Document correctness unspecified. + DOCUMENT_CORRECTNESS_UNSPECIFIED = 0; + + // Information in document is incorrect. + INCORRECT = 1; + + // Information in document is correct. + CORRECT = 2; + } + + // Efficiency of document. + enum DocumentEfficiency { + // Document efficiency unspecified. + DOCUMENT_EFFICIENCY_UNSPECIFIED = 0; + + // Document is inefficient. + INEFFICIENT = 1; + + // Document is efficient. + EFFICIENT = 2; + } + + // Optional. Whether or not the suggested answer is relevant. + // + // For example: + // + // * Query: "Can I change my mailing address?" + // * Suggested document says: "Items must be returned/exchanged within 60 + // days of the purchase date." + // * [answer_relevance][google.cloud.dialogflow.v2.AgentAssistantFeedback.answer_relevance]: [AnswerRelevance.IRRELEVANT][google.cloud.dialogflow.v2.AgentAssistantFeedback.AnswerRelevance.IRRELEVANT] + AnswerRelevance answer_relevance = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether or not the information in the document is correct. + // + // For example: + // + // * Query: "Can I return the package in 2 days once received?" + // * Suggested document says: "Items must be returned/exchanged within 60 + // days of the purchase date." + // * Ground truth: "No return or exchange is allowed." + // * [document_correctness]: INCORRECT + DocumentCorrectness document_correctness = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether or not the suggested document is efficient. For example, + // if the document is poorly written, hard to understand, hard to use or + // too long to find useful information, [document_efficiency][google.cloud.dialogflow.v2.AgentAssistantFeedback.document_efficiency] is + // [DocumentEfficiency.INEFFICIENT][google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentEfficiency.INEFFICIENT]. + DocumentEfficiency document_efficiency = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents a record of a human agent assist answer. +message AgentAssistantRecord { + // Output only. The agent assist answer. + oneof answer { + // Output only. The article suggestion answer. + ArticleAnswer article_suggestion_answer = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The FAQ answer. + FaqAnswer faq_answer = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + } +} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/audio_config.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/audio_config.proto new file mode 100644 index 00000000..53803f51 --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/audio_config.proto @@ -0,0 +1,372 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "AudioConfigProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +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 +// documentation](https://cloud.google.com/speech-to-text/docs/basics) for more +// details. +enum AudioEncoding { + // Not specified. + AUDIO_ENCODING_UNSPECIFIED = 0; + + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + AUDIO_ENCODING_LINEAR_16 = 1; + + // [`FLAC`](https://xiph.org/flac/documentation.html) (Free Lossless Audio + // Codec) is the recommended encoding because it is lossless (therefore + // recognition is not compromised) and requires only about half the + // bandwidth of `LINEAR16`. `FLAC` stream encoding supports 16-bit and + // 24-bit samples, however, not all fields in `STREAMINFO` are supported. + AUDIO_ENCODING_FLAC = 2; + + // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + AUDIO_ENCODING_MULAW = 3; + + // Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000. + AUDIO_ENCODING_AMR = 4; + + // Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000. + AUDIO_ENCODING_AMR_WB = 5; + + // Opus encoded audio frames in Ogg container + // ([OggOpus](https://wiki.xiph.org/OggOpus)). + // `sample_rate_hertz` must be 16000. + AUDIO_ENCODING_OGG_OPUS = 6; + + // Although the use of lossy encodings is not recommended, if a very low + // bitrate encoding is required, `OGG_OPUS` is highly preferred over + // Speex encoding. The [Speex](https://speex.org/) encoding supported by + // Dialogflow API has a header byte in each block, as in MIME type + // `audio/x-speex-with-header-byte`. + // It is a variant of the RTP Speex encoding defined in + // [RFC 5574](https://tools.ietf.org/html/rfc5574). + // The stream is a sequence of blocks, one block per RTP packet. Each block + // starts with a byte containing the length of the block, in bytes, followed + // by one or more frames of Speex data, padded to an integral number of + // bytes (octets) as specified in RFC 5574. In other words, each RTP header + // is replaced with a single byte containing the block length. Only Speex + // wideband is supported. `sample_rate_hertz` must be 16000. + AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7; +} + +// Information for a word recognized by the speech recognizer. +message SpeechWordInfo { + // The word this info is for. + string word = 3; + + // Time offset relative to the beginning of the audio that corresponds to the + // start of the spoken word. This is an experimental feature and the accuracy + // of the time offset can vary. + google.protobuf.Duration start_offset = 1; + + // Time offset relative to the beginning of the audio that corresponds to the + // end of the spoken word. This is an experimental feature and the accuracy of + // the time offset can vary. + google.protobuf.Duration end_offset = 2; + + // The Speech confidence between 0.0 and 1.0 for this word. A higher number + // indicates an estimated greater likelihood that the recognized word is + // correct. The default of 0.0 is a sentinel value indicating that confidence + // was not set. + // + // This field is not guaranteed to be fully stable over time for the same + // audio input. Users should also not rely on it to always be provided. + float confidence = 4; +} + +// Variant of the specified [Speech model][google.cloud.dialogflow.v2.InputAudioConfig.model] to use. +// +// See the [Cloud Speech +// documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) +// for which models have different variants. For example, the "phone_call" model +// has both a standard and an enhanced variant. When you use an enhanced model, +// you will generally receive higher quality results than for a standard model. +enum SpeechModelVariant { + // No model variant specified. In this case Dialogflow defaults to + // USE_BEST_AVAILABLE. + SPEECH_MODEL_VARIANT_UNSPECIFIED = 0; + + // Use the best available variant of the [Speech + // model][InputAudioConfig.model] that the caller is eligible for. + // + // Please see the [Dialogflow + // docs](https://cloud.google.com/dialogflow/docs/data-logging) for + // how to make your project eligible for enhanced models. + USE_BEST_AVAILABLE = 1; + + // Use standard model variant even if an enhanced model is available. See the + // [Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) + // for details about enhanced models. + USE_STANDARD = 2; + + // Use an enhanced model variant: + // + // * If an enhanced variant does not exist for the given + // [model][google.cloud.dialogflow.v2.InputAudioConfig.model] and request language, Dialogflow falls + // back to the standard variant. + // + // The [Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) + // describes which models have enhanced variants. + // + // * If the API caller isn't eligible for enhanced models, Dialogflow returns + // an error. Please see the [Dialogflow + // docs](https://cloud.google.com/dialogflow/docs/data-logging) + // for how to make your project eligible. + USE_ENHANCED = 3; +} + +// Instructs the speech recognizer how to process the audio content. +message InputAudioConfig { + // Required. Audio encoding of the audio content to process. + AudioEncoding audio_encoding = 1; + + // Required. Sample rate (in Hertz) of the audio content sent in the query. + // Refer to + // [Cloud Speech API + // documentation](https://cloud.google.com/speech-to-text/docs/basics) for + // more details. + int32 sample_rate_hertz = 2; + + // Required. The language of the supplied audio. Dialogflow does not do + // translations. See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. Note that queries in + // the same session do not necessarily need to specify the same language. + string language_code = 3; + + // If `true`, Dialogflow returns [SpeechWordInfo][google.cloud.dialogflow.v2.SpeechWordInfo] in + // [StreamingRecognitionResult][google.cloud.dialogflow.v2.StreamingRecognitionResult] with information about the recognized speech + // words, e.g. start and end time offsets. If false or unspecified, Speech + // doesn't return any word-level information. + bool enable_word_info = 13; + + // A list of strings containing words and phrases that the speech + // recognizer should recognize with higher likelihood. + // + // See [the Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) + // for more details. + // + // This field is deprecated. Please use [speech_contexts]() instead. If you + // specify both [phrase_hints]() and [speech_contexts](), Dialogflow will + // treat the [phrase_hints]() as a single additional [SpeechContext](). + repeated string phrase_hints = 4 [deprecated = true]; + + // Context information to assist speech recognition. + // + // See [the Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) + // for more details. + repeated SpeechContext speech_contexts = 11; + + // Which Speech model to select for the given request. Select the + // model best suited to your domain to get best results. If a model is not + // explicitly specified, then we auto-select a model based on the parameters + // in the InputAudioConfig. + // If enhanced speech model is enabled for the agent and an enhanced + // version of the specified model for the language does not exist, then the + // speech is recognized using the standard version of the specified model. + // Refer to + // [Cloud Speech API + // documentation](https://cloud.google.com/speech-to-text/docs/basics#select-model) + // for more details. + string model = 7; + + // Which variant of the [Speech model][google.cloud.dialogflow.v2.InputAudioConfig.model] to use. + SpeechModelVariant model_variant = 10; + + // If `false` (default), recognition does not cease until the + // client closes the stream. + // If `true`, the recognizer will detect a single spoken utterance in input + // audio. Recognition ceases when it detects the audio's voice has + // stopped or paused. In this case, once a detected intent is received, the + // client should close the stream and start a new request with a new stream as + // needed. + // Note: This setting is relevant only for streaming methods. + // Note: When specified, InputAudioConfig.single_utterance takes precedence + // over StreamingDetectIntentRequest.single_utterance. + bool single_utterance = 8; + + // Only used in [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] and + // [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent]. + // If `false` and recognition doesn't return any result, trigger + // `NO_SPEECH_RECOGNIZED` event to Dialogflow agent. + bool disable_no_speech_recognized_event = 14; +} + +// Description of which voice to use for speech synthesis. +message VoiceSelectionParams { + // Optional. The name of the voice. If not set, the service will choose a + // voice based on the other parameters such as language_code and + // [ssml_gender][google.cloud.dialogflow.v2.VoiceSelectionParams.ssml_gender]. + string name = 1; + + // Optional. The preferred gender of the voice. If not set, the service will + // choose a voice based on the other parameters such as language_code and + // [name][google.cloud.dialogflow.v2.VoiceSelectionParams.name]. Note that this is only a preference, not requirement. If a + // voice of the appropriate gender is not available, the synthesizer should + // substitute a voice with a different gender rather than failing the request. + SsmlVoiceGender ssml_gender = 2; +} + +// Configuration of how speech should be synthesized. +message SynthesizeSpeechConfig { + // Optional. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is the normal + // native speed supported by the specific voice. 2.0 is twice as fast, and + // 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any + // other values < 0.25 or > 4.0 will return an error. + double speaking_rate = 1; + + // Optional. Speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20 + // semitones from the original pitch. -20 means decrease 20 semitones from the + // original pitch. + double pitch = 2; + + // Optional. Volume gain (in dB) of the normal native volume supported by the + // specific voice, in the range [-96.0, 16.0]. If unset, or set to a value of + // 0.0 (dB), will play at normal native signal amplitude. A value of -6.0 (dB) + // will play at approximately half the amplitude of the normal native signal + // amplitude. A value of +6.0 (dB) will play at approximately twice the + // amplitude of the normal native signal amplitude. We strongly recommend not + // to exceed +10 (dB) as there's usually no effective increase in loudness for + // any value greater than that. + double volume_gain_db = 3; + + // Optional. An identifier which selects 'audio effects' profiles that are + // applied on (post synthesized) text to speech. Effects are applied on top of + // each other in the order they are given. + repeated string effects_profile_id = 5; + + // Optional. The desired voice of the synthesized audio. + VoiceSelectionParams voice = 4; +} + +// Gender of the voice as described in +// [SSML voice element](https://www.w3.org/TR/speech-synthesis11/#edef_voice). +enum SsmlVoiceGender { + // An unspecified gender, which means that the client doesn't care which + // gender the selected voice will have. + SSML_VOICE_GENDER_UNSPECIFIED = 0; + + // A male voice. + SSML_VOICE_GENDER_MALE = 1; + + // A female voice. + SSML_VOICE_GENDER_FEMALE = 2; + + // A gender-neutral voice. + SSML_VOICE_GENDER_NEUTRAL = 3; +} + +// Instructs the speech synthesizer on how to generate the output audio content. +// If this audio config is supplied in a request, it overrides all existing +// text-to-speech settings applied to the agent. +message OutputAudioConfig { + // Required. Audio encoding of the synthesized audio content. + OutputAudioEncoding audio_encoding = 1 [(google.api.field_behavior) = REQUIRED]; + + // The synthesis sample rate (in hertz) for this audio. If not + // provided, then the synthesizer will use the default sample rate based on + // the audio encoding. If this is different from the voice's natural sample + // rate, then the synthesizer will honor this request by converting to the + // desired sample rate (which might result in worse audio quality). + int32 sample_rate_hertz = 2; + + // Configuration of how speech should be synthesized. + SynthesizeSpeechConfig synthesize_speech_config = 3; +} + +// Configures speech transcription for [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]. +message SpeechToTextConfig { + // Optional. The speech model used in speech to text. + // `SPEECH_MODEL_VARIANT_UNSPECIFIED`, `USE_BEST_AVAILABLE` will be treated as + // `USE_ENHANCED`. It can be overridden in [AnalyzeContentRequest][google.cloud.dialogflow.v2.AnalyzeContentRequest] and + // [StreamingAnalyzeContentRequest][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest] request. + SpeechModelVariant speech_model_variant = 1 [(google.api.field_behavior) = OPTIONAL]; +} + +// Audio encoding of the output audio format in Text-To-Speech. +enum OutputAudioEncoding { + // Not specified. + OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0; + + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + // Audio content returned as LINEAR16 also contains a WAV header. + OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1; + + // MP3 audio at 32kbps. + OUTPUT_AUDIO_ENCODING_MP3 = 2; + + // MP3 audio at 64kbps. + OUTPUT_AUDIO_ENCODING_MP3_64_KBPS = 4; + + // Opus encoded audio wrapped in an ogg container. The result will be a + // file which can be played natively on Android, and in browsers (at least + // Chrome and Firefox). The quality of the encoding is considerably higher + // than MP3 while using approximately the same bitrate. + OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3; + + // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + OUTPUT_AUDIO_ENCODING_MULAW = 5; +} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/context.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/context.proto new file mode 100644 index 00000000..cc6fc325 --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/context.proto @@ -0,0 +1,331 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ContextProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [Contexts][google.cloud.dialogflow.v2.Context]. +service Contexts { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all contexts in the specified session. + rpc ListContexts(ListContextsRequest) returns (ListContextsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/agent/sessions/*}/contexts" + additional_bindings { + get: "/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" + } + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/agent/sessions/*}/contexts" + } + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified context. + rpc GetContext(GetContextRequest) returns (Context) { + option (google.api.http) = { + get: "/v2/{name=projects/*/agent/sessions/*/contexts/*}" + additional_bindings { + get: "/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" + } + additional_bindings { + get: "/v2/{name=projects/*/locations/*/agent/sessions/*/contexts/*}" + } + additional_bindings { + get: "/v2/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a context. + // + // If the specified context already exists, overrides the context. + rpc CreateContext(CreateContextRequest) returns (Context) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent/sessions/*}/contexts" + body: "context" + additional_bindings { + post: "/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" + body: "context" + } + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent/sessions/*}/contexts" + body: "context" + } + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" + body: "context" + } + }; + option (google.api.method_signature) = "parent,context"; + } + + // Updates the specified context. + rpc UpdateContext(UpdateContextRequest) returns (Context) { + option (google.api.http) = { + patch: "/v2/{context.name=projects/*/agent/sessions/*/contexts/*}" + body: "context" + additional_bindings { + patch: "/v2/{context.name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" + body: "context" + } + additional_bindings { + patch: "/v2/{context.name=projects/*/locations/*/agent/sessions/*/contexts/*}" + body: "context" + } + additional_bindings { + patch: "/v2/{context.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" + body: "context" + } + }; + option (google.api.method_signature) = "context,update_mask"; + } + + // Deletes the specified context. + rpc DeleteContext(DeleteContextRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/agent/sessions/*/contexts/*}" + additional_bindings { + delete: "/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" + } + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/agent/sessions/*/contexts/*}" + } + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Deletes all active contexts in the specified session. + rpc DeleteAllContexts(DeleteAllContextsRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{parent=projects/*/agent/sessions/*}/contexts" + additional_bindings { + delete: "/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" + } + additional_bindings { + delete: "/v2/{parent=projects/*/locations/*/agent/sessions/*}/contexts" + } + additional_bindings { + delete: "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" + } + }; + option (google.api.method_signature) = "parent"; + } +} + +// Dialogflow contexts are similar to natural language context. If a person says +// to you "they are orange", you need context in order to understand what "they" +// is referring to. Similarly, for Dialogflow to handle an end-user expression +// like that, it needs to be provided with context in order to correctly match +// an intent. +// +// Using contexts, you can control the flow of a conversation. You can configure +// contexts for an intent by setting input and output contexts, which are +// identified by string names. When an intent is matched, any configured output +// contexts for that intent become active. While any contexts are active, +// Dialogflow is more likely to match intents that are configured with input +// contexts that correspond to the currently active contexts. +// +// For more information about context, see the +// [Contexts guide](https://cloud.google.com/dialogflow/docs/contexts-overview). +message Context { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Context" + pattern: "projects/{project}/agent/sessions/{session}/contexts/{context}" + pattern: "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}" + pattern: "projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}" + pattern: "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}" + }; + + // Required. The unique identifier of the context. Format: + // `projects//agent/sessions//contexts/`, + // or `projects//agent/environments//users//sessions//contexts/`. + // + // The `Context ID` is always converted to lowercase, may only contain + // characters in a-zA-Z0-9_-% and may be at most 250 bytes long. + // + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + // + // The following context names are reserved for internal use by Dialogflow. + // You should not use these contexts or create contexts with these names: + // + // * `__system_counters__` + // * `*_id_dialog_context` + // * `*_dialog_params_size` + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The number of conversational query requests after which the + // context expires. The default is `0`. If set to `0`, the context expires + // immediately. Contexts expire automatically after 20 minutes if there + // are no matching queries. + int32 lifespan_count = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of parameters associated with this context. + // + // Depending on your protocol or client library language, this is a + // map, associative array, symbol table, dictionary, or JSON object + // composed of a collection of (MapKey, MapValue) pairs: + // + // - MapKey type: string + // - MapKey value: parameter name + // - MapValue type: + // - If parameter's entity type is a composite entity: map + // - Else: depending on parameter value type, could be one of string, + // number, boolean, null, list or map + // - MapValue value: + // - If parameter's entity type is a composite entity: + // map from composite entity property names to property values + // - Else: parameter value + google.protobuf.Struct parameters = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts]. +message ListContextsRequest { + // Required. The session to list all contexts from. + // Format: `projects//agent/sessions/` or + // `projects//agent/environments//users//sessions/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Context" + } + ]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts]. +message ListContextsResponse { + // The list of contexts. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Context contexts = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [Contexts.GetContext][google.cloud.dialogflow.v2.Contexts.GetContext]. +message GetContextRequest { + // Required. The name of the context. Format: + // `projects//agent/sessions//contexts/` + // or `projects//agent/environments//users//sessions//contexts/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Context" + } + ]; +} + +// The request message for [Contexts.CreateContext][google.cloud.dialogflow.v2.Contexts.CreateContext]. +message CreateContextRequest { + // Required. The session to create a context for. + // Format: `projects//agent/sessions/` or + // `projects//agent/environments//users//sessions/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Context" + } + ]; + + // Required. The context to create. + Context context = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Contexts.UpdateContext][google.cloud.dialogflow.v2.Contexts.UpdateContext]. +message UpdateContextRequest { + // Required. The context to update. + Context context = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Contexts.DeleteContext][google.cloud.dialogflow.v2.Contexts.DeleteContext]. +message DeleteContextRequest { + // Required. The name of the context to delete. Format: + // `projects//agent/sessions//contexts/` + // or `projects//agent/environments//users//sessions//contexts/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Context" + } + ]; +} + +// The request message for [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2.Contexts.DeleteAllContexts]. +message DeleteAllContextsRequest { + // Required. The name of the session to delete all contexts from. Format: + // `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. + // If `Environment ID` is not specified we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Context" + } + ]; +} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation.proto new file mode 100644 index 00000000..17e06255 --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation.proto @@ -0,0 +1,358 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/participant.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ConversationProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [Conversations][google.cloud.dialogflow.v2.Conversation]. +service Conversations { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Creates a new conversation. Conversations are auto-completed after 24 + // hours. + // + // Conversation Lifecycle: + // There are two stages during a conversation: Automated Agent Stage and + // Assist Stage. + // + // For Automated Agent Stage, there will be a dialogflow agent responding to + // user queries. + // + // For Assist Stage, there's no dialogflow agent responding to user queries. + // But we will provide suggestions which are generated from conversation. + // + // If [Conversation.conversation_profile][google.cloud.dialogflow.v2.Conversation.conversation_profile] is configured for a dialogflow + // agent, conversation will start from `Automated Agent Stage`, otherwise, it + // will start from `Assist Stage`. And during `Automated Agent Stage`, once an + // [Intent][google.cloud.dialogflow.v2.Intent] with [Intent.live_agent_handoff][google.cloud.dialogflow.v2.Intent.live_agent_handoff] is triggered, conversation + // will transfer to Assist Stage. + rpc CreateConversation(CreateConversationRequest) returns (Conversation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/conversations" + body: "conversation" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/conversations" + body: "conversation" + } + }; + option (google.api.method_signature) = "parent,conversation"; + } + + // Returns the list of all conversations in the specified project. + rpc ListConversations(ListConversationsRequest) returns (ListConversationsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/conversations" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/conversations" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specific conversation. + rpc GetConversation(GetConversationRequest) returns (Conversation) { + option (google.api.http) = { + get: "/v2/{name=projects/*/conversations/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/conversations/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Completes the specified conversation. Finished conversations are purged + // from the database after 30 days. + rpc CompleteConversation(CompleteConversationRequest) returns (Conversation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/conversations/*}:complete" + body: "*" + additional_bindings { + post: "/v2/{name=projects/*/locations/*/conversations/*}:complete" + body: "*" + } + }; + option (google.api.method_signature) = "name"; + } + + // Lists messages that belong to a given conversation. + // `messages` are ordered by `create_time` in descending order. To fetch + // updates without duplication, send request with filter + // `create_time_epoch_microseconds > + // [first item's create_time of previous request]` and empty page_token. + rpc ListMessages(ListMessagesRequest) returns (ListMessagesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/conversations/*}/messages" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/conversations/*}/messages" + } + }; + option (google.api.method_signature) = "parent"; + } +} + +// Represents a conversation. +// A conversation is an interaction between an agent, including live agents +// and Dialogflow agents, and a support customer. Conversations can +// include phone calls and text-based chat sessions. +message Conversation { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Conversation" + pattern: "projects/{project}/conversations/{conversation}" + pattern: "projects/{project}/locations/{location}/conversations/{conversation}" + }; + + // Enumeration of the completion status of the conversation. + enum LifecycleState { + // Unknown. + LIFECYCLE_STATE_UNSPECIFIED = 0; + + // Conversation is currently open for media analysis. + IN_PROGRESS = 1; + + // Conversation has been completed. + COMPLETED = 2; + } + + // Enumeration of the different conversation stages a conversation can be in. + // Reference: + // https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages + enum ConversationStage { + // Unknown. Should never be used after a conversation is successfully + // created. + CONVERSATION_STAGE_UNSPECIFIED = 0; + + // The conversation should return virtual agent responses into the + // conversation. + VIRTUAL_AGENT_STAGE = 1; + + // The conversation should not provide responses, just listen and provide + // suggestions. + HUMAN_ASSIST_STAGE = 2; + } + + // Output only. The unique identifier of this conversation. + // Format: `projects//locations//conversations/`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the Conversation. + LifecycleState lifecycle_state = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The Conversation Profile to be used to configure this + // Conversation. This field cannot be updated. + // Format: `projects//locations//conversationProfiles/`. + string conversation_profile = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationProfile" + } + ]; + + // Output only. It will not be empty if the conversation is to be connected over + // telephony. + ConversationPhoneNumber phone_number = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the conversation was started. + google.protobuf.Timestamp start_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the conversation was finished. + google.protobuf.Timestamp end_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The stage of a conversation. It indicates whether the virtual agent or a + // human agent is handling the conversation. + // + // If the conversation is created with the conversation profile that has + // Dialogflow config set, defaults to + // [ConversationStage.VIRTUAL_AGENT_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.VIRTUAL_AGENT_STAGE]; Otherwise, defaults to + // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.HUMAN_ASSIST_STAGE]. + // + // If the conversation is created with the conversation profile that has + // Dialogflow config set but explicitly sets conversation_stage to + // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.HUMAN_ASSIST_STAGE], it skips + // [ConversationStage.VIRTUAL_AGENT_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.VIRTUAL_AGENT_STAGE] stage and directly goes to + // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.HUMAN_ASSIST_STAGE]. + ConversationStage conversation_stage = 7; +} + +// The request message for [Conversations.CreateConversation][google.cloud.dialogflow.v2.Conversations.CreateConversation]. +message CreateConversationRequest { + // Required. Resource identifier of the project creating the conversation. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Conversation" + } + ]; + + // Required. The conversation to create. + Conversation conversation = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Identifier of the conversation. Generally it's auto generated by Google. + // Only set it if you cannot wait for the response to return a + // auto-generated one to you. + // + // The conversation ID must be compliant with the regression fomula + // "[a-zA-Z][a-zA-Z0-9_-]*" with the characters length in range of [3,64]. + // If the field is provided, the caller is resposible for + // 1. the uniqueness of the ID, otherwise the request will be rejected. + // 2. the consistency for whether to use custom ID or not under a project to + // better ensure uniqueness. + string conversation_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Conversations.ListConversations][google.cloud.dialogflow.v2.Conversations.ListConversations]. +message ListConversationsRequest { + // Required. The project from which to list all conversation. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Conversation" + } + ]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // A filter expression that filters conversations listed in the response. In + // general, the expression must specify the field name, a comparison operator, + // and the value to use for filtering: + //
    + //
  • The value must be a string, a number, or a boolean.
  • + //
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + //
  • To filter on multiple expressions, separate the + // expressions with `AND` or `OR` (omitting both implies `AND`).
  • + //
  • For clarity, expressions can be enclosed in parentheses.
  • + //
+ // Only `lifecycle_state` can be filtered on in this way. For example, + // the following expression only returns `COMPLETED` conversations: + // + // `lifecycle_state = "COMPLETED"` + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 4; +} + +// The response message for [Conversations.ListConversations][google.cloud.dialogflow.v2.Conversations.ListConversations]. +message ListConversationsResponse { + // The list of conversations. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Conversation conversations = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [Conversations.GetConversation][google.cloud.dialogflow.v2.Conversations.GetConversation]. +message GetConversationRequest { + // Required. The name of the conversation. Format: + // `projects//locations//conversations/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Conversation" + } + ]; +} + +// The request message for [Conversations.CompleteConversation][google.cloud.dialogflow.v2.Conversations.CompleteConversation]. +message CompleteConversationRequest { + // Required. Resource identifier of the conversation to close. + // Format: `projects//locations//conversations/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Conversation" + } + ]; +} + +// The request message for [Conversations.ListMessages][google.cloud.dialogflow.v2.Conversations.ListMessages]. +message ListMessagesRequest { + // Required. The name of the conversation to list messages for. + // Format: `projects//locations//conversations/` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Message" + } + ]; + + // Optional. Filter on message fields. Currently predicates on `create_time` + // and `create_time_epoch_microseconds` are supported. `create_time` only + // support milliseconds accuracy. E.g., + // `create_time_epoch_microseconds > 1551790877964485` or + // `create_time > 2017-01-15T01:30:15.01Z`. + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Conversations.ListMessages][google.cloud.dialogflow.v2.Conversations.ListMessages]. +message ListMessagesResponse { + // The list of messages. There will be a maximum number of items + // returned based on the page_size field in the request. + // `messages` is sorted by `create_time` in descending order. + repeated Message messages = 1; + + // Token to retrieve the next page of results, or empty if there are + // no more results in the list. + string next_page_token = 2; +} + +// Represents a phone number for telephony integration. It allows for connecting +// a particular conversation over telephony. +message ConversationPhoneNumber { + // Output only. The phone number to connect to this conversation. + string phone_number = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation_event.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation_event.proto new file mode 100644 index 00000000..61cfd75f --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation_event.proto @@ -0,0 +1,86 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/cloud/dialogflow/v2/participant.proto"; +import "google/rpc/status.proto"; +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ConversationEventProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Represents a notification sent to Pub/Sub subscribers for conversation +// lifecycle events. +message ConversationEvent { + // Enumeration of the types of events available. + enum Type { + // Type not set. + TYPE_UNSPECIFIED = 0; + + // A new conversation has been opened. This is fired when a telephone call + // is answered, or a conversation is created via the API. + CONVERSATION_STARTED = 1; + + // An existing conversation has closed. This is fired when a telephone call + // is terminated, or a conversation is closed via the API. + CONVERSATION_FINISHED = 2; + + // An existing conversation has received notification from Dialogflow that + // human intervention is required. + HUMAN_INTERVENTION_NEEDED = 3; + + // An existing conversation has received a new message, either from API or + // telephony. It is configured in + // [ConversationProfile.new_message_event_notification_config][google.cloud.dialogflow.v2.ConversationProfile.new_message_event_notification_config] + NEW_MESSAGE = 5; + + // Unrecoverable error during a telephone call. + // + // In general non-recoverable errors only occur if something was + // misconfigured in the ConversationProfile corresponding to the call. After + // a non-recoverable error, Dialogflow may stop responding. + // + // We don't fire this event: + // + // * in an API call because we can directly return the error, or, + // * when we can recover from an error. + UNRECOVERABLE_ERROR = 4; + } + + // The unique identifier of the conversation this notification + // refers to. + // Format: `projects//conversations/`. + string conversation = 1; + + // The type of the event that this notification refers to. + Type type = 2; + + // More detailed information about an error. Only set for type + // UNRECOVERABLE_ERROR_IN_PHONE_CALL. + google.rpc.Status error_status = 3; + + // Payload of conversation event. + oneof payload { + // Payload of NEW_MESSAGE event. + Message new_message_payload = 4; + } +} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation_profile.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation_profile.proto new file mode 100644 index 00000000..9cae72b7 --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation_profile.proto @@ -0,0 +1,594 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/audio_config.proto"; +import "google/cloud/dialogflow/v2/participant.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ConversationProfileProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; +option (google.api.resource_definition) = { + type: "dialogflow.googleapis.com/CXSecuritySettings" + pattern: "projects/{project}/locations/{location}/securitySettings/{security_settings}" +}; +option (google.api.resource_definition) = { + type: "dialogflow.googleapis.com/ConversationModel" + pattern: "projects/{project}/locations/{location}/conversationModels/{conversation_model}" +}; + +// Service for managing [ConversationProfiles][google.cloud.dialogflow.v2.ConversationProfile]. +service ConversationProfiles { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all conversation profiles in the specified project. + rpc ListConversationProfiles(ListConversationProfilesRequest) returns (ListConversationProfilesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/conversationProfiles" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/conversationProfiles" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified conversation profile. + rpc GetConversationProfile(GetConversationProfileRequest) returns (ConversationProfile) { + option (google.api.http) = { + get: "/v2/{name=projects/*/conversationProfiles/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/conversationProfiles/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a conversation profile in the specified project. + // + // [ConversationProfile.CreateTime][] and [ConversationProfile.UpdateTime][] + // aren't populated in the response. You can retrieve them via + // [GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile] API. + rpc CreateConversationProfile(CreateConversationProfileRequest) returns (ConversationProfile) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/conversationProfiles" + body: "conversation_profile" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/conversationProfiles" + body: "conversation_profile" + } + }; + option (google.api.method_signature) = "parent,conversation_profile"; + } + + // Updates the specified conversation profile. + // + // [ConversationProfile.CreateTime][] and [ConversationProfile.UpdateTime][] + // aren't populated in the response. You can retrieve them via + // [GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile] API. + rpc UpdateConversationProfile(UpdateConversationProfileRequest) returns (ConversationProfile) { + option (google.api.http) = { + patch: "/v2/{conversation_profile.name=projects/*/conversationProfiles/*}" + body: "conversation_profile" + additional_bindings { + patch: "/v2/{conversation_profile.name=projects/*/locations/*/conversationProfiles/*}" + body: "conversation_profile" + } + }; + option (google.api.method_signature) = "conversation_profile,update_mask"; + } + + // Deletes the specified conversation profile. + rpc DeleteConversationProfile(DeleteConversationProfileRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/conversationProfiles/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/conversationProfiles/*}" + } + }; + option (google.api.method_signature) = "name"; + } +} + +// Defines the services to connect to incoming Dialogflow conversations. +message ConversationProfile { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/ConversationProfile" + pattern: "projects/{project}/conversationProfiles/{conversation_profile}" + pattern: "projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}" + }; + + // The unique identifier of this conversation profile. + // Format: `projects//locations//conversationProfiles/`. + string name = 1; + + // Required. Human readable name for this profile. Max length 1024 bytes. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Create time of the conversation profile. + google.protobuf.Timestamp create_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Update time of the conversation profile. + google.protobuf.Timestamp update_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Configuration for an automated agent to use with this profile. + AutomatedAgentConfig automated_agent_config = 3; + + // Configuration for agent assistance to use with this profile. + HumanAgentAssistantConfig human_agent_assistant_config = 4; + + // Configuration for connecting to a live agent. + // + // Currently, this feature is not general available, please contact Google + // to get access. + HumanAgentHandoffConfig human_agent_handoff_config = 5; + + // Configuration for publishing conversation lifecycle events. + NotificationConfig notification_config = 6; + + // Configuration for logging conversation lifecycle events. + LoggingConfig logging_config = 7; + + // Configuration for publishing new message events. Event will be sent in + // format of [ConversationEvent][google.cloud.dialogflow.v2.ConversationEvent] + NotificationConfig new_message_event_notification_config = 8; + + // Settings for speech transcription. + SpeechToTextConfig stt_config = 9; + + // Language which represents the conversationProfile. + // If unspecified, the default language code en-us applies. Users need to + // create a ConversationProfile for each language they want to support. + string language_code = 10; +} + +// The request message for [ConversationProfiles.ListConversationProfiles][google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles]. +message ListConversationProfilesRequest { + // Required. The project to list all conversation profiles from. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/ConversationProfile" + } + ]; + + // The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// The response message for [ConversationProfiles.ListConversationProfiles][google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles]. +message ListConversationProfilesResponse { + // The list of project conversation profiles. There is a maximum number + // of items returned based on the page_size field in the request. + repeated ConversationProfile conversation_profiles = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [ConversationProfiles.GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]. +message GetConversationProfileRequest { + // Required. The resource name of the conversation profile. + // Format: `projects//locations//conversationProfiles/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationProfile" + } + ]; +} + +// The request message for [ConversationProfiles.CreateConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.CreateConversationProfile]. +message CreateConversationProfileRequest { + // Required. The project to create a conversation profile for. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/ConversationProfile" + } + ]; + + // Required. The conversation profile to create. + ConversationProfile conversation_profile = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [ConversationProfiles.UpdateConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.UpdateConversationProfile]. +message UpdateConversationProfileRequest { + // Required. The conversation profile to update. + ConversationProfile conversation_profile = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields to update. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [ConversationProfiles.DeleteConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.DeleteConversationProfile]. +// +// This operation fails if the conversation profile is still referenced from +// a phone number. +message DeleteConversationProfileRequest { + // Required. The name of the conversation profile to delete. + // Format: `projects//locations//conversationProfiles/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationProfile" + } + ]; +} + +// Defines the Automated Agent to connect to a conversation. +message AutomatedAgentConfig { + // Required. ID of the Dialogflow agent environment to use. + // + // This project needs to either be the same project as the conversation or you + // need to grant `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow API + // Service Agent` role in this project. + // + // Format: `projects//locations//agent/environments/`. If environment is not + // specified, the default `draft` environment is used. Refer to + // [DetectIntentRequest](/dialogflow/docs/reference/rpc/google.cloud.dialogflow.v2#google.cloud.dialogflow.v2.DetectIntentRequest) + // for more details. + string agent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Agent" + } + ]; +} + +// Defines the Human Agent Assist to connect to a conversation. +message HumanAgentAssistantConfig { + // Settings of suggestion trigger. + message SuggestionTriggerSettings { + // Do not trigger if last utterance is small talk. + bool no_smalltalk = 1; + + // Only trigger suggestion if participant role of last utterance is + // END_USER. + bool only_end_user = 2; + } + + // Config for suggestion features. + message SuggestionFeatureConfig { + // The suggestion feature. + SuggestionFeature suggestion_feature = 5; + + // Automatically iterates all participants and tries to compile + // suggestions. + // + // Supported features: ARTICLE_SUGGESTION, FAQ, DIALOGFLOW_ASSIST. + bool enable_event_based_suggestion = 3; + + // Settings of suggestion trigger. + // + // Currently, only ARTICLE_SUGGESTION and FAQ will use this field. + SuggestionTriggerSettings suggestion_trigger_settings = 10; + + // Configs of query. + SuggestionQueryConfig query_config = 6; + + // Configs of custom conversation model. + ConversationModelConfig conversation_model_config = 7; + } + + // Detail human agent assistant config. + message SuggestionConfig { + // Configuration of different suggestion features. One feature can have only + // one config. + repeated SuggestionFeatureConfig feature_configs = 2; + + // If `group_suggestion_responses` is false, and there are multiple + // `feature_configs` in `event based suggestion` or + // StreamingAnalyzeContent, we will try to deliver suggestions to customers + // as soon as we get new suggestion. Different type of suggestions based on + // the same context will be in separate Pub/Sub event or + // `StreamingAnalyzeContentResponse`. + // + // If `group_suggestion_responses` set to true. All the suggestions to the + // same participant based on the same context will be grouped into a single + // Pub/Sub event or StreamingAnalyzeContentResponse. + bool group_suggestion_responses = 3; + } + + // Config for suggestion query. + message SuggestionQueryConfig { + // Knowledge base source settings. + // + // Supported features: ARTICLE_SUGGESTION, FAQ. + message KnowledgeBaseQuerySource { + // Required. Knowledge bases to query. Format: + // `projects//locations//knowledgeBases/`. Currently, at most 5 knowledge + // bases are supported. + repeated string knowledge_bases = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/KnowledgeBase" + } + ]; + } + + // Document source settings. + // + // Supported features: SMART_REPLY, SMART_COMPOSE. + message DocumentQuerySource { + // Required. Knowledge documents to query from. Format: + // `projects//locations//knowledgeBases//documents/`. + // Currently, at most 5 documents are supported. + repeated string documents = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + } + ]; + } + + // Dialogflow source setting. + // + // Supported feature: DIALOGFLOW_ASSIST. + message DialogflowQuerySource { + // Required. The name of a Dialogflow virtual agent used for end user side intent + // detection and suggestion. Format: `projects//locations//agent`. When multiple agents are allowed in + // the same Dialogflow project. + string agent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Agent" + } + ]; + } + + // Settings that determine how to filter recent conversation context when + // generating suggestions. + message ContextFilterSettings { + // If set to true, the last message from virtual agent (hand off message) + // and the message before it (trigger message of hand off) are dropped. + bool drop_handoff_messages = 1; + + // If set to true, all messages from virtual agent are dropped. + bool drop_virtual_agent_messages = 2; + + // If set to true, all messages from ivr stage are dropped. + bool drop_ivr_messages = 3; + } + + // Source of query. + oneof query_source { + // Query from knowledgebase. It is used by: + // ARTICLE_SUGGESTION, FAQ. + KnowledgeBaseQuerySource knowledge_base_query_source = 1; + + // Query from knowledge base document. It is used by: + // SMART_REPLY, SMART_COMPOSE. + DocumentQuerySource document_query_source = 2; + + // Query from Dialogflow agent. It is used by DIALOGFLOW_ASSIST. + DialogflowQuerySource dialogflow_query_source = 3; + } + + // Maximum number of results to return. Currently, if unset, defaults to 10. + // And the max number is 20. + int32 max_results = 4; + + // Confidence threshold of query result. + // + // Agent Assist gives each suggestion a score in the range [0.0, 1.0], based + // on the relevance between the suggestion and the current conversation + // context. A score of 0.0 has no relevance, while a score of 1.0 has high + // relevance. Only suggestions with a score greater than or equal to the + // value of this field are included in the results. + // + // For a baseline model (the default), the recommended value is in the range + // [0.05, 0.1]. + // + // For a custom model, there is no recommended value. Tune this value by + // starting from a very low value and slowly increasing until you have + // desired results. + // + // If this field is not set, it defaults to 0.0, which means that all + // suggestions are returned. + // + // Supported features: ARTICLE_SUGGESTION. + float confidence_threshold = 5; + + // Determines how recent conversation context is filtered when generating + // suggestions. If unspecified, no messages will be dropped. + ContextFilterSettings context_filter_settings = 7; + } + + // Custom conversation models used in agent assist feature. + // + // Supported feature: ARTICLE_SUGGESTION, SMART_COMPOSE, SMART_REPLY. + message ConversationModelConfig { + // Conversation model resource name. Format: `projects//conversationModels/`. + string model = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationModel" + }]; + } + + // Configuration for analyses to run on each conversation message. + message MessageAnalysisConfig { + // Enable entity extraction in conversation messages on [agent assist + // stage](https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages). + // If unspecified, defaults to false. + // + // Currently, this feature is not general available, please contact Google + // to get access. + bool enable_entity_extraction = 2; + + // Enable sentiment analysis in conversation messages on [agent assist + // stage](https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages). + // If unspecified, defaults to false. Sentiment analysis inspects user input + // and identifies the prevailing subjective opinion, especially to determine + // a user's attitude as positive, negative, or neutral: + // https://cloud.google.com/natural-language/docs/basics#sentiment_analysis + // For [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent] method, result will be in + // [StreamingAnalyzeContentResponse.message.SentimentAnalysisResult][google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.message]. + // For [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] method, result will be in + // [AnalyzeContentResponse.message.SentimentAnalysisResult][google.cloud.dialogflow.v2.AnalyzeContentResponse.message] + // For [Conversations.ListMessages][google.cloud.dialogflow.v2.Conversations.ListMessages] method, result will be in + // [ListMessagesResponse.messages.SentimentAnalysisResult][google.cloud.dialogflow.v2.ListMessagesResponse.messages] + // If Pub/Sub notification is configured, result will be in + // [ConversationEvent.new_message_payload.SentimentAnalysisResult][google.cloud.dialogflow.v2.ConversationEvent.new_message_payload]. + bool enable_sentiment_analysis = 3; + } + + // Pub/Sub topic on which to publish new agent assistant events. + NotificationConfig notification_config = 2; + + // Configuration for agent assistance of human agent participant. + SuggestionConfig human_agent_suggestion_config = 3; + + // Configuration for agent assistance of end user participant. + // + // Currently, this feature is not general available, please contact Google + // to get access. + SuggestionConfig end_user_suggestion_config = 4; + + // Configuration for message analysis. + MessageAnalysisConfig message_analysis_config = 5; +} + +// Defines the hand off to a live agent, typically on which external agent +// service provider to connect to a conversation. +// +// Currently, this feature is not general available, please contact Google +// to get access. +message HumanAgentHandoffConfig { + // Configuration specific to LivePerson (https://www.liveperson.com). + message LivePersonConfig { + // Required. Account number of the LivePerson account to connect. This is + // the account number you input at the login page. + string account_number = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // Configuration specific to Salesforce Live Agent. + message SalesforceLiveAgentConfig { + // Required. The organization ID of the Salesforce account. + string organization_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Live Agent deployment ID. + string deployment_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Live Agent chat button ID. + string button_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Domain of the Live Agent endpoint for this agent. You can find + // the endpoint URL in the `Live Agent settings` page. For example if URL + // has the form https://d.la4-c2-phx.salesforceliveagent.com/..., + // you should fill in d.la4-c2-phx.salesforceliveagent.com. + string endpoint_domain = 4 [(google.api.field_behavior) = REQUIRED]; + } + + // Required. Specifies which agent service to connect for human agent handoff. + oneof agent_service { + // Uses LivePerson (https://www.liveperson.com). + LivePersonConfig live_person_config = 1; + + // Uses Salesforce Live Agent. + SalesforceLiveAgentConfig salesforce_live_agent_config = 2; + } +} + +// Defines notification behavior. +message NotificationConfig { + // Format of cloud pub/sub message. + enum MessageFormat { + // If it is unspeified, PROTO will be used. + MESSAGE_FORMAT_UNSPECIFIED = 0; + + // Pubsub message will be serialized proto. + PROTO = 1; + + // Pubsub message will be json. + JSON = 2; + } + + // Name of the Pub/Sub topic to publish conversation + // events like + // [CONVERSATION_STARTED][google.cloud.dialogflow.v2.ConversationEvent.Type.CONVERSATION_STARTED] as + // serialized [ConversationEvent][google.cloud.dialogflow.v2.ConversationEvent] protos. + // + // Notification works for phone calls, if this topic either is in the same + // project as the conversation or you grant `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow Service + // Agent` role in the topic project. + // + // Format: `projects//locations//topics/`. + string topic = 1; + + // Format of message. + MessageFormat message_format = 2; +} + +// Defines logging behavior for conversation lifecycle events. +message LoggingConfig { + // Whether to log conversation events like + // [CONVERSATION_STARTED][google.cloud.dialogflow.v2.ConversationEvent.Type.CONVERSATION_STARTED] to + // Stackdriver in the conversation project as JSON format + // [ConversationEvent][google.cloud.dialogflow.v2.ConversationEvent] protos. + bool enable_stackdriver_logging = 3; +} + +// The type of Human Agent Assistant API suggestion to perform, and the maximum +// number of results to return for that type. Multiple `Feature` objects can +// be specified in the `features` list. +message SuggestionFeature { + // Defines the type of Human Agent Assistant feature. + enum Type { + // Unspecified feature type. + TYPE_UNSPECIFIED = 0; + + // Run article suggestion model. + ARTICLE_SUGGESTION = 1; + + // Run FAQ model. + FAQ = 2; + } + + // Type of Human Agent Assistant API feature to request. + Type type = 1; +} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/document.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/document.proto new file mode 100644 index 00000000..a3bc4b77 --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/document.proto @@ -0,0 +1,410 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "DocumentProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing knowledge [Documents][google.cloud.dialogflow.v2.Document]. +service Documents { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all documents of the knowledge base. + rpc ListDocuments(ListDocumentsRequest) returns (ListDocumentsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/knowledgeBases/*}/documents" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/knowledgeBases/*}/documents" + } + additional_bindings { + get: "/v2/{parent=projects/*/agent/knowledgeBases/*}/documents" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified document. + rpc GetDocument(GetDocumentRequest) returns (Document) { + option (google.api.http) = { + get: "/v2/{name=projects/*/knowledgeBases/*/documents/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}" + } + additional_bindings { + get: "/v2/{name=projects/*/agent/knowledgeBases/*/documents/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new document. + // + // Operation + rpc CreateDocument(CreateDocumentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/knowledgeBases/*}/documents" + body: "document" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/knowledgeBases/*}/documents" + body: "document" + } + additional_bindings { + post: "/v2/{parent=projects/*/agent/knowledgeBases/*}/documents" + body: "document" + } + }; + option (google.api.method_signature) = "parent,document"; + option (google.longrunning.operation_info) = { + response_type: "Document" + metadata_type: "KnowledgeOperationMetadata" + }; + } + + // Deletes the specified document. + // + // Operation + rpc DeleteDocument(DeleteDocumentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/knowledgeBases/*/documents/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}" + } + additional_bindings { + delete: "/v2/{name=projects/*/agent/knowledgeBases/*/documents/*}" + } + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "KnowledgeOperationMetadata" + }; + } + + // Updates the specified document. + // + // Operation + rpc UpdateDocument(UpdateDocumentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2/{document.name=projects/*/knowledgeBases/*/documents/*}" + body: "document" + additional_bindings { + patch: "/v2/{document.name=projects/*/locations/*/knowledgeBases/*/documents/*}" + body: "document" + } + additional_bindings { + patch: "/v2/{document.name=projects/*/agent/knowledgeBases/*/documents/*}" + body: "document" + } + }; + option (google.api.method_signature) = "document,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Document" + metadata_type: "KnowledgeOperationMetadata" + }; + } + + // Reloads the specified document from its specified source, content_uri or + // content. The previously loaded content of the document will be deleted. + // Note: Even when the content of the document has not changed, there still + // may be side effects because of internal implementation changes. + // + // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + // only use `projects.knowledgeBases.documents`. + // + // Operation + rpc ReloadDocument(ReloadDocumentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/knowledgeBases/*/documents/*}:reload" + body: "*" + additional_bindings { + post: "/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}:reload" + body: "*" + } + additional_bindings { + post: "/v2/{name=projects/*/agent/knowledgeBases/*/documents/*}:reload" + body: "*" + } + }; + option (google.api.method_signature) = "name,content_uri"; + option (google.longrunning.operation_info) = { + response_type: "Document" + metadata_type: "KnowledgeOperationMetadata" + }; + } +} + +// A knowledge document to be used by a [KnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBase]. +// +// For more information, see the [knowledge base +// guide](https://cloud.google.com/dialogflow/docs/how/knowledge-bases). +// +// Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; +// only use `projects.knowledgeBases.documents`. +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. + message ReloadStatus { + // The time of a reload attempt. + // This reload may have been triggered automatically or manually and may + // not have succeeded. + google.protobuf.Timestamp time = 1; + + // The status of a reload attempt or the initial load. + google.rpc.Status status = 2; + } + + // The knowledge type of document content. + enum KnowledgeType { + // The type is unspecified or arbitrary. + KNOWLEDGE_TYPE_UNSPECIFIED = 0; + + // The document content contains question and answer pairs as either HTML or + // CSV. Typical FAQ HTML formats are parsed accurately, but unusual formats + // may fail to be parsed. + // + // CSV must have questions in the first column and answers in the second, + // with no header. Because of this explicit format, they are always parsed + // accurately. + FAQ = 1; + + // Documents for which unstructured text is extracted and used for + // question answering. + EXTRACTIVE_QA = 2; + + // The entire document content as a whole can be used for query results. + // Only for Contact Center Solutions on Dialogflow. + ARTICLE_SUGGESTION = 3; + } + + // Optional. The document resource name. + // The name must be empty when creating a document. + // 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 + // less; otherwise, the creation request fails. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The MIME type of this document. + string mime_type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The knowledge type of document content. + repeated KnowledgeType knowledge_types = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. The source of this document. + oneof source { + // The URI where the file content is located. + // + // For documents stored in Google Cloud Storage, these URIs must have + // the form `gs:///`. + // + // NOTE: External URLs must correspond to public webpages, i.e., they must + // be indexed by Google Search. In particular, URLs for showing documents in + // Google Cloud Storage (i.e. the URL in your browser) are not supported. + // Instead use the `gs://` format URI described above. + string content_uri = 5; + + // The raw content of the document. This field is only permitted for + // EXTRACTIVE_QA and FAQ knowledge types. + bytes raw_content = 9; + } + + // Optional. If true, we try to automatically reload the document every day + // (at a time picked by the system). If false or unspecified, we don't try + // to automatically reload the document. + // + // Currently you can only enable automatic reload for documents sourced from + // a public url, see `source` field for the source types. + // + // Reload status can be tracked in `latest_reload_status`. If a reload + // fails, we will keep the document unchanged. + // + // If a reload fails with internal errors, the system will try to reload the + // document on the next day. + // If a reload fails with non-retriable errors (e.g. PERMISION_DENIED), the + // system will not try to reload the document anymore. You need to manually + // reload the document successfully by calling `ReloadDocument` and clear the + // errors. + bool enable_auto_reload = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The time and status of the latest reload. + // This reload may have been triggered automatically or manually + // and may not have succeeded. + ReloadStatus latest_reload_status = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Metadata for the document. The metadata supports arbitrary + // key-value pairs. Suggested use cases include storing a document's title, + // an external URL distinct from the document's content_uri, etc. + // The max size of a `key` or a `value` of the metadata is 1024 bytes. + map metadata = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [Documents.GetDocument][google.cloud.dialogflow.v2.Documents.GetDocument]. +message GetDocumentRequest { + // Required. The name of the document to retrieve. + // Format `projects//locations//knowledgeBases//documents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + } + ]; +} + +// Request message for [Documents.ListDocuments][google.cloud.dialogflow.v2.Documents.ListDocuments]. +message ListDocumentsRequest { + // Required. The knowledge base to list all documents for. + // Format: `projects//locations//knowledgeBases/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Document" + } + ]; + + // The maximum number of items to return in a single page. By + // default 10 and at most 100. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// Response message for [Documents.ListDocuments][google.cloud.dialogflow.v2.Documents.ListDocuments]. +message ListDocumentsResponse { + // The list of documents. + repeated Document documents = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// Request message for [Documents.CreateDocument][google.cloud.dialogflow.v2.Documents.CreateDocument]. +message CreateDocumentRequest { + // Required. The knowledge base to create a document for. + // Format: `projects//locations//knowledgeBases/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Document" + } + ]; + + // Required. The document to create. + Document document = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for [Documents.DeleteDocument][google.cloud.dialogflow.v2.Documents.DeleteDocument]. +message DeleteDocumentRequest { + // Required. The name of the document to delete. + // Format: `projects//locations//knowledgeBases//documents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + } + ]; +} + +// Request message for [Documents.UpdateDocument][google.cloud.dialogflow.v2.Documents.UpdateDocument]. +message UpdateDocumentRequest { + // Required. The document to update. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Not specified means `update all`. + // Currently, only `display_name` can be updated, an InvalidArgument will be + // returned for attempting to update other fields. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [Documents.ReloadDocument][google.cloud.dialogflow.v2.Documents.ReloadDocument]. +message ReloadDocumentRequest { + // Required. The name of the document to reload. + // Format: `projects//locations//knowledgeBases//documents/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + } + ]; + + // The source for document reloading. + // If provided, the service will load the contents from the source + // and update document in the knowledge base. + oneof source { + // Optional. The path of gcs source file for reloading document content. For now, + // only gcs uri is supported. + // + // For documents stored in Google Cloud Storage, these URIs must have + // the form `gs:///`. + string content_uri = 3 [(google.api.field_behavior) = OPTIONAL]; + } +} + +// Metadata in google::longrunning::Operation for Knowledge operations. +message KnowledgeOperationMetadata { + // States of the operation. + enum State { + // State unspecified. + STATE_UNSPECIFIED = 0; + + // The operation has been created. + PENDING = 1; + + // The operation is currently running. + RUNNING = 2; + + // The operation is done, either cancelled or completed. + DONE = 3; + } + + // Output only. The current state of this operation. + State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/entity_type.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/entity_type.proto new file mode 100644 index 00000000..3d076d64 --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/entity_type.proto @@ -0,0 +1,569 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "EntityTypeProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [EntityTypes][google.cloud.dialogflow.v2.EntityType]. +service EntityTypes { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all entity types in the specified agent. + rpc ListEntityTypes(ListEntityTypesRequest) returns (ListEntityTypesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/agent}/entityTypes" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/agent}/entityTypes" + } + }; + option (google.api.method_signature) = "parent"; + option (google.api.method_signature) = "parent,language_code"; + } + + // Retrieves the specified entity type. + rpc GetEntityType(GetEntityTypeRequest) returns (EntityType) { + option (google.api.http) = { + get: "/v2/{name=projects/*/agent/entityTypes/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/agent/entityTypes/*}" + } + }; + option (google.api.method_signature) = "name"; + option (google.api.method_signature) = "name,language_code"; + } + + // Creates an entity type in the specified agent. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc CreateEntityType(CreateEntityTypeRequest) returns (EntityType) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent}/entityTypes" + body: "entity_type" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent}/entityTypes" + body: "entity_type" + } + }; + option (google.api.method_signature) = "parent,entity_type"; + option (google.api.method_signature) = "parent,entity_type,language_code"; + } + + // Updates the specified entity type. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc UpdateEntityType(UpdateEntityTypeRequest) returns (EntityType) { + option (google.api.http) = { + patch: "/v2/{entity_type.name=projects/*/agent/entityTypes/*}" + body: "entity_type" + additional_bindings { + patch: "/v2/{entity_type.name=projects/*/locations/*/agent/entityTypes/*}" + body: "entity_type" + } + }; + option (google.api.method_signature) = "entity_type"; + option (google.api.method_signature) = "entity_type,language_code"; + } + + // Deletes the specified entity type. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc DeleteEntityType(DeleteEntityTypeRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/agent/entityTypes/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/agent/entityTypes/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Updates/Creates multiple entity types in the specified agent. + // + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc BatchUpdateEntityTypes(BatchUpdateEntityTypesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent}/entityTypes:batchUpdate" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent}/entityTypes:batchUpdate" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse" + metadata_type: "google.protobuf.Struct" + }; + } + + // Deletes entity types in the specified agent. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc BatchDeleteEntityTypes(BatchDeleteEntityTypesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent}/entityTypes:batchDelete" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent}/entityTypes:batchDelete" + body: "*" + } + }; + option (google.api.method_signature) = "parent,entity_type_names"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Creates multiple new entities in the specified entity type. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc BatchCreateEntities(BatchCreateEntitiesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchCreate" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchCreate" + body: "*" + } + }; + option (google.api.method_signature) = "parent,entities"; + option (google.api.method_signature) = "parent,entities,language_code"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Updates or creates multiple entities in the specified entity type. This + // method does not affect entities in the entity type that aren't explicitly + // specified in the request. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc BatchUpdateEntities(BatchUpdateEntitiesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchUpdate" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchUpdate" + body: "*" + } + }; + option (google.api.method_signature) = "parent,entities"; + option (google.api.method_signature) = "parent,entities,language_code"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Deletes entities in the specified entity type. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc BatchDeleteEntities(BatchDeleteEntitiesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchDelete" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchDelete" + body: "*" + } + }; + option (google.api.method_signature) = "parent,entity_values"; + option (google.api.method_signature) = "parent,entity_values,language_code"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } +} + +// Each intent parameter has a type, called the entity type, which dictates +// exactly how data from an end-user expression is extracted. +// +// Dialogflow provides predefined system entities that can match many common +// types of data. For example, there are system entities for matching dates, +// times, colors, email addresses, and so on. You can also create your own +// custom entities for matching custom data. For example, you could define a +// vegetable entity that can match the types of vegetables available for +// purchase with a grocery store agent. +// +// For more information, see the +// [Entity guide](https://cloud.google.com/dialogflow/docs/entities-overview). +message EntityType { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/EntityType" + pattern: "projects/{project}/agent/entityTypes/{entity_type}" + pattern: "projects/{project}/locations/{location}/agent/entityTypes/{entity_type}" + }; + + // An **entity entry** for an associated entity type. + message Entity { + // Required. The primary value associated with this entity entry. + // For example, if the entity type is *vegetable*, the value could be + // *scallions*. + // + // For `KIND_MAP` entity types: + // + // * A reference value to be used in place of synonyms. + // + // For `KIND_LIST` entity types: + // + // * A string that can contain references to other entity types (with or + // without aliases). + string value = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A collection of value synonyms. For example, if the entity type + // is *vegetable*, and `value` is *scallions*, a synonym could be *green + // onions*. + // + // For `KIND_LIST` entity types: + // + // * This collection must contain exactly one synonym equal to `value`. + repeated string synonyms = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Represents kinds of entities. + enum Kind { + // Not specified. This value should be never used. + KIND_UNSPECIFIED = 0; + + // Map entity types allow mapping of a group of synonyms to a reference + // value. + KIND_MAP = 1; + + // List entity types contain a set of entries that do not map to reference + // values. However, list entity types can contain references to other entity + // types (with or without aliases). + KIND_LIST = 2; + + // Regexp entity types allow to specify regular expressions in entries + // values. + KIND_REGEXP = 3; + } + + // Represents different entity type expansion modes. Automated expansion + // allows an agent to recognize values that have not been explicitly listed in + // the entity (for example, new kinds of shopping list items). + enum AutoExpansionMode { + // Auto expansion disabled for the entity. + AUTO_EXPANSION_MODE_UNSPECIFIED = 0; + + // Allows an agent to recognize values that have not been explicitly + // listed in the entity. + AUTO_EXPANSION_MODE_DEFAULT = 1; + } + + // The unique identifier of the entity type. + // Required for [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType] and + // [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes] methods. + // Format: `projects//agent/entityTypes/`. + string name = 1; + + // Required. The name of the entity type. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Indicates the kind of entity type. + Kind kind = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates whether the entity type can be automatically + // expanded. + AutoExpansionMode auto_expansion_mode = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of entity entries associated with the entity type. + repeated Entity entities = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Enables fuzzy entity extraction during classification. + bool enable_fuzzy_extraction = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes]. +message ListEntityTypesRequest { + // Required. The agent to list all entity types from. + // Format: `projects//agent`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes]. +message ListEntityTypesResponse { + // The list of agent entity types. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated EntityType entity_types = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [EntityTypes.GetEntityType][google.cloud.dialogflow.v2.EntityTypes.GetEntityType]. +message GetEntityTypeRequest { + // Required. The name of the entity type. + // Format: `projects//agent/entityTypes/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.CreateEntityType][google.cloud.dialogflow.v2.EntityTypes.CreateEntityType]. +message CreateEntityTypeRequest { + // Required. The agent to create a entity type for. + // Format: `projects//agent`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The entity type to create. + EntityType entity_type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType]. +message UpdateEntityTypeRequest { + // Required. The entity type to update. + EntityType entity_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.DeleteEntityType][google.cloud.dialogflow.v2.EntityTypes.DeleteEntityType]. +message DeleteEntityTypeRequest { + // Required. The name of the entity type to delete. + // Format: `projects//agent/entityTypes/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; +} + +// The request message for [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes]. +message BatchUpdateEntityTypesRequest { + // Required. The name of the agent to update or create entity types in. + // Format: `projects//agent`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // The source of the entity type batch. + // + // For each entity type in the batch: + // + // * If `name` is specified, we update an existing entity type. + // * If `name` is not specified, we create a new entity type. + oneof entity_type_batch { + // The URI to a Google Cloud Storage file containing entity types to update + // or create. The file format can either be a serialized proto (of + // EntityBatch type) or a JSON object. Note: The URI must start with + // "gs://". + string entity_type_batch_uri = 2; + + // The collection of entity types to update or create. + EntityTypeBatch entity_type_batch_inline = 3; + } + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes]. +message BatchUpdateEntityTypesResponse { + // The collection of updated or created entity types. + repeated EntityType entity_types = 1; +} + +// The request message for [EntityTypes.BatchDeleteEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntityTypes]. +message BatchDeleteEntityTypesRequest { + // Required. The name of the agent to delete all entities types for. Format: + // `projects//agent`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The names entity types to delete. All names must point to the + // same agent as `parent`. + repeated string entity_type_names = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2.EntityTypes.BatchCreateEntities]. +message BatchCreateEntitiesRequest { + // Required. The name of the entity type to create entities in. Format: + // `projects//agent/entityTypes/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The entities to create. + repeated EntityType.Entity entities = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.BatchUpdateEntities][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntities]. +message BatchUpdateEntitiesRequest { + // Required. The name of the entity type to update or create entities in. + // Format: `projects//agent/entityTypes/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The entities to update or create. + repeated EntityType.Entity entities = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.BatchDeleteEntities][google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntities]. +message BatchDeleteEntitiesRequest { + // Required. The name of the entity type to delete entries for. Format: + // `projects//agent/entityTypes/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The reference `values` of the entities to delete. Note that + // these are not fully-qualified names, i.e. they don't start with + // `projects/`. + repeated string entity_values = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// This message is a wrapper around a collection of entity types. +message EntityTypeBatch { + // A collection of entity types. + repeated EntityType entity_types = 1; +} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/environment.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/environment.proto new file mode 100644 index 00000000..a25e7050 --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/environment.proto @@ -0,0 +1,390 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/audio_config.proto"; +import "google/cloud/dialogflow/v2/fulfillment.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "EnvironmentProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [Environments][google.cloud.dialogflow.v2.Environment]. +service Environments { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all non-default environments of the specified agent. + rpc ListEnvironments(ListEnvironmentsRequest) returns (ListEnvironmentsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/agent}/environments" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/agent}/environments" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified agent environment. + rpc GetEnvironment(GetEnvironmentRequest) returns (Environment) { + option (google.api.http) = { + get: "/v2/{name=projects/*/agent/environments/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/agent/environments/*}" + } + }; + } + + // Creates an agent environment. + rpc CreateEnvironment(CreateEnvironmentRequest) returns (Environment) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent}/environments" + body: "environment" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent}/environments" + body: "environment" + } + }; + } + + // Updates the specified agent environment. + // + // This method allows you to deploy new agent versions into the environment. + // When an environment is pointed to a new agent version by setting + // `environment.agent_version`, the environment is temporarily set to the + // `LOADING` state. During that time, the environment continues serving the + // previous version of the agent. After the new agent version is done loading, + // the environment is set back to the `RUNNING` state. + // You can use "-" as Environment ID in environment name to update an agent + // version in the default environment. WARNING: this will negate all recent + // changes to the draft agent and can't be undone. You may want to save the + // draft agent to a version before calling this method. + rpc UpdateEnvironment(UpdateEnvironmentRequest) returns (Environment) { + option (google.api.http) = { + patch: "/v2/{environment.name=projects/*/agent/environments/*}" + body: "environment" + additional_bindings { + patch: "/v2/{environment.name=projects/*/locations/*/agent/environments/*}" + body: "environment" + } + }; + } + + // Deletes the specified agent environment. + rpc DeleteEnvironment(DeleteEnvironmentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/agent/environments/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/agent/environments/*}" + } + }; + } + + // Gets the history of the specified environment. + rpc GetEnvironmentHistory(GetEnvironmentHistoryRequest) returns (EnvironmentHistory) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/agent/environments/*}/history" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/agent/environments/*}/history" + } + }; + } +} + +// You can create multiple versions of your agent and publish them to separate +// environments. +// +// When you edit an agent, you are editing the draft agent. At any point, you +// can save the draft agent as an agent version, which is an immutable snapshot +// of your agent. +// +// When you save the draft agent, it is published to the default environment. +// When you create agent versions, you can publish them to custom environments. +// You can create a variety of custom environments for: +// +// - testing +// - development +// - production +// - etc. +// +// For more information, see the [versions and environments +// guide](https://cloud.google.com/dialogflow/docs/agents-versions). +message Environment { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Environment" + pattern: "projects/{project}/agent/environments/{environment}" + pattern: "projects/{project}/locations/{location}/agent/environments/{environment}" + }; + + // Represents an environment state. When an environment is pointed to a new + // agent version, the environment is temporarily set to the `LOADING` state. + // During that time, the environment keeps on serving the previous version of + // the agent. After the new agent version is done loading, the environment is + // set back to the `RUNNING` state. + enum State { + // Not specified. This value is not used. + STATE_UNSPECIFIED = 0; + + // Stopped. + STOPPED = 1; + + // Loading. + LOADING = 2; + + // Running. + RUNNING = 3; + } + + // Output only. The unique identifier of this agent environment. + // Supported formats: + // + // - `projects//agent/environments/` + // - `projects//locations//agent/environments/` + // + // The environment ID for the default environment is `-`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The developer-provided description for this environment. + // The maximum length is 500 characters. If exceeded, the request is rejected. + string description = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The agent version loaded into this environment. + // Supported formats: + // + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` + string agent_version = 3 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Version" + } + ]; + + // Output only. The state of this environment. This field is read-only, i.e., it cannot be + // set by create and update methods. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update time of this environment. This field is read-only, i.e., it + // cannot be set by create and update methods. + google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Text to speech settings for this environment. + TextToSpeechSettings text_to_speech_settings = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The fulfillment settings to use for this environment. + Fulfillment fulfillment = 8 [(google.api.field_behavior) = OPTIONAL]; +} + +// Instructs the speech synthesizer on how to generate the output audio content. +message TextToSpeechSettings { + // Optional. Indicates whether text to speech is enabled. Even when this field is false, + // other settings in this proto are still retained. + bool enable_text_to_speech = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Audio encoding of the synthesized audio content. + OutputAudioEncoding output_audio_encoding = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The synthesis sample rate (in hertz) for this audio. If not provided, then + // the synthesizer will use the default sample rate based on the audio + // encoding. If this is different from the voice's natural sample rate, then + // the synthesizer will honor this request by converting to the desired sample + // rate (which might result in worse audio quality). + int32 sample_rate_hertz = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Configuration of how speech should be synthesized, mapping from language + // (https://cloud.google.com/dialogflow/docs/reference/language) to + // SynthesizeSpeechConfig. + map synthesize_speech_configs = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Environments.ListEnvironments][google.cloud.dialogflow.v2.Environments.ListEnvironments]. +message ListEnvironmentsRequest { + // Required. The agent to list all environments from. + // Format: + // + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Environment" + } + ]; + + // Optional. The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Environments.ListEnvironments][google.cloud.dialogflow.v2.Environments.ListEnvironments]. +message ListEnvironmentsResponse { + // The list of agent environments. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Environment environments = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [Environments.GetEnvironment][google.cloud.dialogflow.v2.Environments.GetEnvironment]. +message GetEnvironmentRequest { + // Required. The name of the environment. + // Supported formats: + // + // - `projects//agent/environments/` + // - `projects//locations//agent/environments/` + // + // The environment ID for the default environment is `-`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Environment" + } + ]; +} + +// The request message for [Environments.CreateEnvironment][google.cloud.dialogflow.v2.Environments.CreateEnvironment]. +message CreateEnvironmentRequest { + // Required. The agent to create an environment for. + // Supported formats: + // + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Environment" + } + ]; + + // Required. The environment to create. + Environment environment = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The unique id of the new environment. + string environment_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Environments.UpdateEnvironment][google.cloud.dialogflow.v2.Environments.UpdateEnvironment]. +message UpdateEnvironmentRequest { + // Required. The environment to update. + Environment environment = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. This field is used to prevent accidental overwrite of the default + // environment, which is an operation that cannot be undone. To confirm that + // the caller desires this overwrite, this field must be explicitly set to + // true when updating the default environment (environment ID = `-`). + bool allow_load_to_draft_and_discard_changes = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Environments.DeleteEnvironment][google.cloud.dialogflow.v2.Environments.DeleteEnvironment]. +message DeleteEnvironmentRequest { + // Required. The name of the environment to delete. + // / Format: + // + // - `projects//agent/environments/` + // - `projects//locations//agent/environments/` + // + // The environment ID for the default environment is `-`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Environment" + } + ]; +} + +// The request message for [Environments.GetEnvironmentHistory][google.cloud.dialogflow.v2.Environments.GetEnvironmentHistory]. +message GetEnvironmentHistoryRequest { + // Required. The name of the environment to retrieve history for. + // Supported formats: + // + // - `projects//agent/environments/` + // - `projects//locations//agent/environments/` + // + // The environment ID for the default environment is `-`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Environment" + } + ]; + + // Optional. The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Environments.GetEnvironmentHistory][google.cloud.dialogflow.v2.Environments.GetEnvironmentHistory]. +message EnvironmentHistory { + // Represents an environment history entry. + message Entry { + // The agent version loaded into this environment history entry. + string agent_version = 1; + + // The developer-provided description for this environment history entry. + string description = 2; + + // The creation time of this environment history entry. + google.protobuf.Timestamp create_time = 3; + } + + // Output only. The name of the environment this history is for. + // Supported formats: + // + // - `projects//agent/environments/` + // - `projects//locations//agent/environments/` + // + // The environment ID for the default environment is `-`. + string parent = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The list of agent environments. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Entry entries = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/fulfillment.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/fulfillment.proto new file mode 100644 index 00000000..b4fe186b --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/fulfillment.proto @@ -0,0 +1,174 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "FulfillmentProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [Fulfillments][google.cloud.dialogflow.v2.Fulfillment]. +service Fulfillments { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Retrieves the fulfillment. + rpc GetFulfillment(GetFulfillmentRequest) returns (Fulfillment) { + option (google.api.http) = { + get: "/v2/{name=projects/*/agent/fulfillment}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/agent/fulfillment}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Updates the fulfillment. + rpc UpdateFulfillment(UpdateFulfillmentRequest) returns (Fulfillment) { + option (google.api.http) = { + patch: "/v2/{fulfillment.name=projects/*/agent/fulfillment}" + body: "fulfillment" + additional_bindings { + patch: "/v2/{fulfillment.name=projects/*/locations/*/agent/fulfillment}" + body: "fulfillment" + } + }; + option (google.api.method_signature) = "fulfillment,update_mask"; + } +} + +// By default, your agent responds to a matched intent with a static response. +// As an alternative, you can provide a more dynamic response by using +// fulfillment. When you enable fulfillment for an intent, Dialogflow responds +// to that intent by calling a service that you define. For example, if an +// end-user wants to schedule a haircut on Friday, your service can check your +// database and respond to the end-user with availability information for +// Friday. +// +// For more information, see the [fulfillment +// guide](https://cloud.google.com/dialogflow/docs/fulfillment-overview). +message Fulfillment { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Fulfillment" + pattern: "projects/{project}/agent/fulfillment" + pattern: "projects/{project}/locations/{location}/agent/fulfillment" + }; + + // Represents configuration for a generic web service. + // Dialogflow supports two mechanisms for authentications: + // - Basic authentication with username and password. + // - Authentication with additional authentication headers. + // More information could be found at: + // https://cloud.google.com/dialogflow/docs/fulfillment-configure. + message GenericWebService { + // Required. The fulfillment URI for receiving POST requests. + // It must use https protocol. + string uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The user name for HTTP Basic authentication. + string username = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The password for HTTP Basic authentication. + string password = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The HTTP request headers to send together with fulfillment requests. + map request_headers = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates if generic web service is created through Cloud Functions + // integration. Defaults to false. + // + // is_cloud_function is deprecated. Cloud functions can be configured by + // its uri as a regular web service now. + bool is_cloud_function = 5 [ + deprecated = true, + (google.api.field_behavior) = OPTIONAL + ]; + } + + // Whether fulfillment is enabled for the specific feature. + message Feature { + // The type of the feature. + enum Type { + // Feature type not specified. + TYPE_UNSPECIFIED = 0; + + // Fulfillment is enabled for SmallTalk. + SMALLTALK = 1; + } + + // The type of the feature that enabled for fulfillment. + Type type = 1; + } + + // Required. The unique identifier of the fulfillment. + // Supported formats: + // - `projects//agent/fulfillment` + // - `projects//locations//agent/fulfillment` + // + // This field is not used for Fulfillment in an Environment. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The human-readable name of the fulfillment, unique within the agent. + // + // This field is not used for Fulfillment in an Environment. + string display_name = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The fulfillment configuration. + oneof fulfillment { + // Configuration for a generic web service. + GenericWebService generic_web_service = 3; + } + + // Optional. Whether fulfillment is enabled. + bool enabled = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The field defines whether the fulfillment is enabled for certain features. + repeated Feature features = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Fulfillments.GetFulfillment][google.cloud.dialogflow.v2.Fulfillments.GetFulfillment]. +message GetFulfillmentRequest { + // Required. The name of the fulfillment. + // Format: `projects//agent/fulfillment`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Fulfillment" + } + ]; +} + +// The request message for [Fulfillments.UpdateFulfillment][google.cloud.dialogflow.v2.Fulfillments.UpdateFulfillment]. +message UpdateFulfillmentRequest { + // Required. The fulfillment to update. + Fulfillment fulfillment = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields get updated. If the mask is not + // present, all fields will be updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/gcs.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/gcs.proto new file mode 100644 index 00000000..1fb2dc99 --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/gcs.proto @@ -0,0 +1,28 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/api/field_behavior.proto"; +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "GcsProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto new file mode 100644 index 00000000..f79ce9d4 --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto @@ -0,0 +1,44 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/cloud/dialogflow/v2/participant.proto"; +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "HumanAgentAssistantEventProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Represents a notification sent to Cloud Pub/Sub subscribers for +// human agent assistant events in a specific conversation. +message HumanAgentAssistantEvent { + // The conversation this notification refers to. + // Format: `projects//conversations/`. + string conversation = 1; + + // The participant that the suggestion is compiled for. + // Format: `projects//conversations//participants/`. It will not be set in legacy workflow. + string participant = 3; + + // The suggestion results payload that this notification refers to. + repeated SuggestionResult suggestion_results = 5; +} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/intent.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/intent.proto new file mode 100644 index 00000000..fae280ce --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/intent.proto @@ -0,0 +1,1097 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/audio_config.proto"; +import "google/cloud/dialogflow/v2/context.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "IntentProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [Intents][google.cloud.dialogflow.v2.Intent]. +service Intents { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all intents in the specified agent. + rpc ListIntents(ListIntentsRequest) returns (ListIntentsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/agent}/intents" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/agent}/intents" + } + additional_bindings { + get: "/v2/{parent=projects/*/agent/environments/*}/intents" + } + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/agent/environments/*}/intents" + } + }; + option (google.api.method_signature) = "parent"; + option (google.api.method_signature) = "parent,language_code"; + } + + // Retrieves the specified intent. + rpc GetIntent(GetIntentRequest) returns (Intent) { + option (google.api.http) = { + get: "/v2/{name=projects/*/agent/intents/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/agent/intents/*}" + } + }; + option (google.api.method_signature) = "name"; + option (google.api.method_signature) = "name,language_code"; + } + + // Creates an intent in the specified agent. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc CreateIntent(CreateIntentRequest) returns (Intent) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent}/intents" + body: "intent" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent}/intents" + body: "intent" + } + }; + option (google.api.method_signature) = "parent,intent"; + option (google.api.method_signature) = "parent,intent,language_code"; + } + + // Updates the specified intent. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc UpdateIntent(UpdateIntentRequest) returns (Intent) { + option (google.api.http) = { + patch: "/v2/{intent.name=projects/*/agent/intents/*}" + body: "intent" + additional_bindings { + patch: "/v2/{intent.name=projects/*/locations/*/agent/intents/*}" + body: "intent" + } + }; + option (google.api.method_signature) = "intent,language_code"; + option (google.api.method_signature) = "intent,language_code,update_mask"; + } + + // Deletes the specified intent and its direct or indirect followup intents. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc DeleteIntent(DeleteIntentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/agent/intents/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/agent/intents/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Updates/Creates multiple intents in the specified agent. + // + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc BatchUpdateIntents(BatchUpdateIntentsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent}/intents:batchUpdate" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent}/intents:batchUpdate" + body: "*" + } + }; + option (google.api.method_signature) = "parent,intent_batch_uri"; + option (google.api.method_signature) = "parent,intent_batch_inline"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.dialogflow.v2.BatchUpdateIntentsResponse" + metadata_type: "google.protobuf.Struct" + }; + } + + // Deletes intents in the specified agent. + // + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc BatchDeleteIntents(BatchDeleteIntentsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent}/intents:batchDelete" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent}/intents:batchDelete" + body: "*" + } + }; + option (google.api.method_signature) = "parent,intents"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } +} + +// An intent categorizes an end-user's intention for one conversation turn. For +// each agent, you define many intents, where your combined intents can handle a +// complete conversation. When an end-user writes or says something, referred to +// as an end-user expression or end-user input, Dialogflow matches the end-user +// input to the best intent in your agent. Matching an intent is also known as +// intent classification. +// +// For more information, see the [intent +// guide](https://cloud.google.com/dialogflow/docs/intents-overview). +message Intent { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Intent" + pattern: "projects/{project}/agent/intents/{intent}" + pattern: "projects/{project}/locations/{location}/agent/intents/{intent}" + }; + + // Represents an example that the agent is trained on. + message TrainingPhrase { + // Represents a part of a training phrase. + message Part { + // Required. The text for this part. + string text = 1; + + // Optional. The entity type name prefixed with `@`. + // This field is required for annotated parts of the training phrase. + string entity_type = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The parameter name for the value extracted from the + // annotated part of the example. + // This field is required for annotated parts of the training phrase. + string alias = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether the text was manually annotated. + // This field is set to true when the Dialogflow Console is used to + // manually annotate the part. When creating an annotated part with the + // API, you must set this to true. + bool user_defined = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // Represents different types of training phrases. + enum Type { + // Not specified. This value should never be used. + TYPE_UNSPECIFIED = 0; + + // Examples do not contain @-prefixed entity type names, but example parts + // can be annotated with entity types. + EXAMPLE = 1; + + // Templates are not annotated with entity types, but they can contain + // @-prefixed entity type names as substrings. + // Template mode has been deprecated. Example mode is the only supported + // way to create new training phrases. If you have existing training + // phrases that you've created in template mode, those will continue to + // work. + TEMPLATE = 2 [deprecated = true]; + } + + // Output only. The unique identifier of this training phrase. + string name = 1; + + // Required. The type of the training phrase. + Type type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ordered list of training phrase parts. + // The parts are concatenated in order to form the training phrase. + // + // Note: The API does not automatically annotate training phrases like the + // Dialogflow Console does. + // + // Note: Do not forget to include whitespace at part boundaries, + // so the training phrase is well formatted when the parts are concatenated. + // + // If the training phrase does not need to be annotated with parameters, + // you just need a single part with only the [Part.text][google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part.text] field set. + // + // If you want to annotate the training phrase, you must create multiple + // parts, where the fields of each part are populated in one of two ways: + // + // - `Part.text` is set to a part of the phrase that has no parameters. + // - `Part.text` is set to a part of the phrase that you want to annotate, + // and the `entity_type`, `alias`, and `user_defined` fields are all + // set. + repeated Part parts = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates how many times this example was added to + // the intent. Each time a developer adds an existing sample by editing an + // intent or training, this counter is increased. + int32 times_added_count = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // Represents intent parameters. + message Parameter { + // The unique identifier of this parameter. + string name = 1; + + // Required. The name of the parameter. + string display_name = 2; + + // Optional. The definition of the parameter value. It can be: + // + // - a constant string, + // - a parameter value defined as `$parameter_name`, + // - an original parameter value defined as `$parameter_name.original`, + // - a parameter value from some context defined as + // `#context_name.parameter_name`. + string value = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The default value to use when the `value` yields an empty + // result. + // Default values can be extracted from contexts by using the following + // syntax: `#context_name.parameter_name`. + string default_value = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the entity type, prefixed with `@`, that + // describes values of the parameter. If the parameter is + // required, this must be provided. + string entity_type_display_name = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether the parameter is required. That is, + // whether the intent cannot be completed without collecting the parameter + // value. + bool mandatory = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of prompts that the agent can present to the + // user in order to collect a value for the parameter. + repeated string prompts = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether the parameter represents a list of values. + bool is_list = 8 [(google.api.field_behavior) = OPTIONAL]; + } + + // A rich response message. + // Corresponds to the intent `Response` field in the Dialogflow console. + // For more information, see + // [Rich response + // messages](https://cloud.google.com/dialogflow/docs/intents-rich-messages). + message Message { + // The text response message. + message Text { + // Optional. The collection of the agent's responses. + repeated string text = 1 [(google.api.field_behavior) = OPTIONAL]; + } + + // The image response message. + message Image { + // Optional. The public URI to an image file. + string image_uri = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A text description of the image to be used for accessibility, + // e.g., screen readers. + string accessibility_text = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // The quick replies response message. + message QuickReplies { + // Optional. The title of the collection of quick replies. + string title = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of quick replies. + repeated string quick_replies = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // The card response message. + message Card { + // Contains information about a button. + message Button { + // Optional. The text to show on the button. + string text = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The text to send back to the Dialogflow API or a URI to + // open. + string postback = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. The title of the card. + string title = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The subtitle of the card. + string subtitle = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The public URI to an image file for the card. + string image_uri = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of card buttons. + repeated Button buttons = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // The simple response message containing speech or text. + message SimpleResponse { + // One of text_to_speech or ssml must be provided. The plain text of the + // speech output. Mutually exclusive with ssml. + string text_to_speech = 1; + + // One of text_to_speech or ssml must be provided. Structured spoken + // response to the user in the SSML format. Mutually exclusive with + // text_to_speech. + string ssml = 2; + + // Optional. The text to display. + string display_text = 3 [(google.api.field_behavior) = OPTIONAL]; + } + + // The collection of simple response candidates. + // This message in `QueryResult.fulfillment_messages` and + // `WebhookResponse.fulfillment_messages` should contain only one + // `SimpleResponse`. + message SimpleResponses { + // Required. The list of simple responses. + repeated SimpleResponse simple_responses = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // The basic card message. Useful for displaying information. + message BasicCard { + // The button object that appears at the bottom of a card. + message Button { + // Opens the given URI. + message OpenUriAction { + // Required. The HTTP or HTTPS scheme URI. + string uri = 1; + } + + // Required. The title of the button. + string title = 1; + + // Required. Action to take when a user taps on the button. + OpenUriAction open_uri_action = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Optional. The title of the card. + string title = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The subtitle of the card. + string subtitle = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required, unless image is present. The body text of the card. + string formatted_text = 3; + + // Optional. The image for the card. + Image image = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of card buttons. + repeated Button buttons = 5 [(google.api.field_behavior) = OPTIONAL]; + } + + // The suggestion chip message that the user can tap to quickly post a reply + // to the conversation. + message Suggestion { + // Required. The text shown the in the suggestion chip. + string title = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // The collection of suggestions. + message Suggestions { + // Required. The list of suggested replies. + repeated Suggestion suggestions = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // The suggestion chip message that allows the user to jump out to the app + // or website associated with this agent. + message LinkOutSuggestion { + // Required. The name of the app or site this chip is linking to. + string destination_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The URI of the app or site to open when the user taps the + // suggestion chip. + string uri = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // The card for presenting a list of options to select from. + message ListSelect { + // An item in the list. + message Item { + // Required. Additional information about this option. + SelectItemInfo info = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The title of the list item. + string title = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The main text describing the item. + string description = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The image to display. + Image image = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. The overall title of the list. + string title = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. List items. + repeated Item items = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Subtitle of the list. + string subtitle = 3 [(google.api.field_behavior) = OPTIONAL]; + } + + // The card for presenting a carousel of options to select from. + message CarouselSelect { + // An item in the carousel. + message Item { + // Required. Additional info about the option item. + SelectItemInfo info = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Title of the carousel item. + string title = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The body text of the card. + string description = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The image to display. + Image image = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // Required. Carousel items. + repeated Item items = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // Additional info about the select item for when it is triggered in a + // dialog. + message SelectItemInfo { + // Required. A unique key that will be sent back to the agent if this + // response is given. + string key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A list of synonyms that can also be used to trigger this + // item in dialog. + repeated string synonyms = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // The media content card for Actions on Google. + message MediaContent { + // Response media object for media content card. + message ResponseMediaObject { + // Required. Name of media card. + string name = 1; + + // Optional. Description of media card. + string description = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Image to show with the media card. + oneof image { + // Optional. Image to display above media content. + Image large_image = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Icon to display above media content. + Image icon = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // Required. Url where the media is stored. + string content_url = 5; + } + + // Format of response media type. + enum ResponseMediaType { + // Unspecified. + RESPONSE_MEDIA_TYPE_UNSPECIFIED = 0; + + // Response media type is audio. + AUDIO = 1; + } + + // Optional. What type of media is the content (ie "audio"). + ResponseMediaType media_type = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. List of media objects. + repeated ResponseMediaObject media_objects = 2; + } + + // Browse Carousel Card for Actions on Google. + // https://developers.google.com/actions/assistant/responses#browsing_carousel + message BrowseCarouselCard { + // Browsing carousel tile + message BrowseCarouselCardItem { + // Actions on Google action to open a given url. + message OpenUrlAction { + // Type of the URI. + enum UrlTypeHint { + // Unspecified + URL_TYPE_HINT_UNSPECIFIED = 0; + + // Url would be an amp action + AMP_ACTION = 1; + + // URL that points directly to AMP content, or to a canonical URL + // which refers to AMP content via . + AMP_CONTENT = 2; + } + + // Required. URL + string url = 1; + + // Optional. Specifies the type of viewer that is used when opening + // the URL. Defaults to opening via web browser. + UrlTypeHint url_type_hint = 3 [(google.api.field_behavior) = OPTIONAL]; + } + + // Required. Action to present to the user. + OpenUrlAction open_uri_action = 1; + + // Required. Title of the carousel item. Maximum of two lines of text. + string title = 2; + + // Optional. Description of the carousel item. Maximum of four lines of + // text. + string description = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Hero image for the carousel item. + Image image = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Text that appears at the bottom of the Browse Carousel + // Card. Maximum of one line of text. + string footer = 5 [(google.api.field_behavior) = OPTIONAL]; + } + + // Image display options for Actions on Google. This should be used for + // when the image's aspect ratio does not match the image container's + // aspect ratio. + enum ImageDisplayOptions { + // Fill the gaps between the image and the image container with gray + // bars. + IMAGE_DISPLAY_OPTIONS_UNSPECIFIED = 0; + + // Fill the gaps between the image and the image container with gray + // bars. + GRAY = 1; + + // Fill the gaps between the image and the image container with white + // bars. + WHITE = 2; + + // Image is scaled such that the image width and height match or exceed + // the container dimensions. This may crop the top and bottom of the + // image if the scaled image height is greater than the container + // height, or crop the left and right of the image if the scaled image + // width is greater than the container width. This is similar to "Zoom + // Mode" on a widescreen TV when playing a 4:3 video. + CROPPED = 3; + + // Pad the gaps between image and image frame with a blurred copy of the + // same image. + BLURRED_BACKGROUND = 4; + } + + // Required. List of items in the Browse Carousel Card. Minimum of two + // items, maximum of ten. + repeated BrowseCarouselCardItem items = 1; + + // Optional. Settings for displaying the image. Applies to every image in + // [items][google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.items]. + ImageDisplayOptions image_display_options = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Table card for Actions on Google. + message TableCard { + // Required. Title of the card. + string title = 1; + + // Optional. Subtitle to the title. + string subtitle = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Image which should be displayed on the card. + Image image = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Display properties for the columns in this table. + repeated ColumnProperties column_properties = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Rows in this table of data. + repeated TableCardRow rows = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. List of buttons for the card. + repeated BasicCard.Button buttons = 6 [(google.api.field_behavior) = OPTIONAL]; + } + + // Column properties for [TableCard][google.cloud.dialogflow.v2.Intent.Message.TableCard]. + message ColumnProperties { + // Text alignments within a cell. + enum HorizontalAlignment { + // Text is aligned to the leading edge of the column. + HORIZONTAL_ALIGNMENT_UNSPECIFIED = 0; + + // Text is aligned to the leading edge of the column. + LEADING = 1; + + // Text is centered in the column. + CENTER = 2; + + // Text is aligned to the trailing edge of the column. + TRAILING = 3; + } + + // Required. Column heading. + string header = 1; + + // Optional. Defines text alignment for all cells in this column. + HorizontalAlignment horizontal_alignment = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Row of [TableCard][google.cloud.dialogflow.v2.Intent.Message.TableCard]. + message TableCardRow { + // Optional. List of cells that make up this row. + repeated TableCardCell cells = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether to add a visual divider after this row. + bool divider_after = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Cell of [TableCardRow][google.cloud.dialogflow.v2.Intent.Message.TableCardRow]. + message TableCardCell { + // Required. Text in this cell. + string text = 1; + } + + // The rich response message integration platform. See + // [Integrations](https://cloud.google.com/dialogflow/docs/integrations). + enum Platform { + // Default platform. + PLATFORM_UNSPECIFIED = 0; + + // Facebook. + FACEBOOK = 1; + + // Slack. + SLACK = 2; + + // Telegram. + TELEGRAM = 3; + + // Kik. + KIK = 4; + + // Skype. + SKYPE = 5; + + // Line. + LINE = 6; + + // Viber. + VIBER = 7; + + // Google Assistant + // See [Dialogflow webhook + // format](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json) + ACTIONS_ON_GOOGLE = 8; + + // Google Hangouts. + GOOGLE_HANGOUTS = 11; + } + + // Required. The rich response message. + oneof message { + // The text response. + Text text = 1; + + // The image response. + Image image = 2; + + // The quick replies response. + QuickReplies quick_replies = 3; + + // The card response. + Card card = 4; + + // A custom platform-specific response. + google.protobuf.Struct payload = 5; + + // The voice and text-only responses for Actions on Google. + SimpleResponses simple_responses = 7; + + // The basic card response for Actions on Google. + BasicCard basic_card = 8; + + // The suggestion chips for Actions on Google. + Suggestions suggestions = 9; + + // The link out suggestion chip for Actions on Google. + LinkOutSuggestion link_out_suggestion = 10; + + // The list card response for Actions on Google. + ListSelect list_select = 11; + + // The carousel card response for Actions on Google. + CarouselSelect carousel_select = 12; + + // Browse carousel card for Actions on Google. + BrowseCarouselCard browse_carousel_card = 22; + + // Table card for Actions on Google. + TableCard table_card = 23; + + // The media content card for Actions on Google. + MediaContent media_content = 24; + } + + // Optional. The platform that this message is intended for. + Platform platform = 6 [(google.api.field_behavior) = OPTIONAL]; + } + + // Represents a single followup intent in the chain. + message FollowupIntentInfo { + // The unique identifier of the followup intent. + // Format: `projects//agent/intents/`. + string followup_intent_name = 1; + + // The unique identifier of the followup intent's parent. + // Format: `projects//agent/intents/`. + string parent_followup_intent_name = 2; + } + + // Represents the different states that webhooks can be in. + enum WebhookState { + // Webhook is disabled in the agent and in the intent. + WEBHOOK_STATE_UNSPECIFIED = 0; + + // Webhook is enabled in the agent and in the intent. + WEBHOOK_STATE_ENABLED = 1; + + // Webhook is enabled in the agent and in the intent. Also, each slot + // filling prompt is forwarded to the webhook. + WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING = 2; + } + + // Optional. The unique identifier of this intent. + // Required for [Intents.UpdateIntent][google.cloud.dialogflow.v2.Intents.UpdateIntent] and [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2.Intents.BatchUpdateIntents] + // methods. + // Format: `projects//agent/intents/`. + string name = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The name of this intent. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates whether webhooks are enabled for the intent. + WebhookState webhook_state = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The priority of this intent. Higher numbers represent higher + // priorities. + // + // - If the supplied value is unspecified or 0, the service + // translates the value to 500,000, which corresponds to the + // `Normal` priority in the console. + // - If the supplied value is negative, the intent is ignored + // in runtime detect intent requests. + int32 priority = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether this is a fallback intent. + bool is_fallback = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether Machine Learning is disabled for the intent. + // Note: If `ml_disabled` setting is set to true, then this intent is not + // taken into account during inference in `ML ONLY` match mode. Also, + // auto-markup in the UI is turned off. + bool ml_disabled = 19 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates that a live agent should be brought in to handle the + // interaction with the user. In most cases, when you set this flag to true, + // you would also want to set end_interaction to true as well. Default is + // false. + bool live_agent_handoff = 20 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates that this intent ends an interaction. Some integrations + // (e.g., Actions on Google or Dialogflow phone gateway) use this information + // to close interaction with an end user. Default is false. + bool end_interaction = 21 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The list of context names required for this intent to be + // triggered. + // Format: `projects//agent/sessions/-/contexts/`. + repeated string input_context_names = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of event names that trigger the intent. + // If the collection of input contexts is not empty, all of the contexts must + // be present in the active user session for an event to trigger this intent. + // Event names are limited to 150 characters. + repeated string events = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of examples that the agent is + // trained on. + repeated TrainingPhrase training_phrases = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the action associated with the intent. + // Note: The action name must not contain whitespaces. + string action = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of contexts that are activated when the intent + // is matched. Context messages in this collection should not set the + // parameters field. Setting the `lifespan_count` to 0 will reset the context + // when the intent is matched. + // Format: `projects//agent/sessions/-/contexts/`. + repeated Context output_contexts = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether to delete all contexts in the current + // session when this intent is matched. + bool reset_contexts = 12 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of parameters associated with the intent. + repeated Parameter parameters = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of rich messages corresponding to the + // `Response` field in the Dialogflow console. + repeated Message messages = 14 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The list of platforms for which the first responses will be + // copied from the messages in PLATFORM_UNSPECIFIED (i.e. default platform). + repeated Message.Platform default_response_platforms = 15 [(google.api.field_behavior) = OPTIONAL]; + + // Read-only. The unique identifier of the root intent in the chain of + // followup intents. It identifies the correct followup intents chain for + // this intent. We populate this field only in the output. + // + // Format: `projects//agent/intents/`. + string root_followup_intent_name = 16; + + // Read-only after creation. The unique identifier of the parent intent in the + // chain of followup intents. You can set this field when creating an intent, + // for example with [CreateIntent][google.cloud.dialogflow.v2.Intents.CreateIntent] or + // [BatchUpdateIntents][google.cloud.dialogflow.v2.Intents.BatchUpdateIntents], in order to make this + // intent a followup intent. + // + // It identifies the parent followup intent. + // Format: `projects//agent/intents/`. + string parent_followup_intent_name = 17; + + // Read-only. Information about all followup intents that have this intent as + // a direct or indirect parent. We populate this field only in the output. + repeated FollowupIntentInfo followup_intent_info = 18; +} + +// The request message for [Intents.ListIntents][google.cloud.dialogflow.v2.Intents.ListIntents]. +message ListIntentsRequest { + // Required. The agent to list all intents from. + // Format: `projects//agent` or `projects//locations//agent`. + // + // Alternatively, you can specify the environment to list intents for. + // Format: `projects//agent/environments/` + // or `projects//locations//agent/environments/`. + // Note: training phrases of the intents will not be returned for non-draft + // environment. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Intent" + } + ]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The resource view to apply to the returned intent. + IntentView intent_view = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Intents.ListIntents][google.cloud.dialogflow.v2.Intents.ListIntents]. +message ListIntentsResponse { + // The list of agent intents. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Intent intents = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [Intents.GetIntent][google.cloud.dialogflow.v2.Intents.GetIntent]. +message GetIntentRequest { + // Required. The name of the intent. + // Format: `projects//agent/intents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Intent" + } + ]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The resource view to apply to the returned intent. + IntentView intent_view = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Intents.CreateIntent][google.cloud.dialogflow.v2.Intents.CreateIntent]. +message CreateIntentRequest { + // Required. The agent to create a intent for. + // Format: `projects//agent`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Intent" + } + ]; + + // Required. The intent to create. + Intent intent = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The resource view to apply to the returned intent. + IntentView intent_view = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Intents.UpdateIntent][google.cloud.dialogflow.v2.Intents.UpdateIntent]. +message UpdateIntentRequest { + // Required. The intent to update. + Intent intent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The resource view to apply to the returned intent. + IntentView intent_view = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Intents.DeleteIntent][google.cloud.dialogflow.v2.Intents.DeleteIntent]. +message DeleteIntentRequest { + // Required. The name of the intent to delete. If this intent has direct or + // indirect followup intents, we also delete them. + // Format: `projects//agent/intents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Intent" + } + ]; +} + +message BatchUpdateIntentsRequest { + // Required. The name of the agent to update or create intents in. + // Format: `projects//agent`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Intent" + } + ]; + + // The source of the intent batch. + oneof intent_batch { + // The URI to a Google Cloud Storage file containing intents to update or + // create. The file format can either be a serialized proto (of IntentBatch + // type) or JSON object. Note: The URI must start with "gs://". + string intent_batch_uri = 2; + + // The collection of intents to update or create. + IntentBatch intent_batch_inline = 3; + } + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The resource view to apply to the returned intent. + IntentView intent_view = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2.Intents.BatchUpdateIntents]. +message BatchUpdateIntentsResponse { + // The collection of updated or created intents. + repeated Intent intents = 1; +} + +// The request message for [Intents.BatchDeleteIntents][google.cloud.dialogflow.v2.Intents.BatchDeleteIntents]. +message BatchDeleteIntentsRequest { + // Required. The name of the agent to delete all entities types for. Format: + // `projects//agent`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Intent" + } + ]; + + // Required. The collection of intents to delete. Only intent `name` must be + // filled in. + repeated Intent intents = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// This message is a wrapper around a collection of intents. +message IntentBatch { + // A collection of intents. + repeated Intent intents = 1; +} + +// Represents the options for views of an intent. +// An intent can be a sizable object. Therefore, we provide a resource view that +// does not return training phrases in the response by default. +enum IntentView { + // Training phrases field is not populated in the response. + INTENT_VIEW_UNSPECIFIED = 0; + + // All fields are populated. + INTENT_VIEW_FULL = 1; +} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/knowledge_base.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/knowledge_base.proto new file mode 100644 index 00000000..0b1aa8b3 --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/knowledge_base.proto @@ -0,0 +1,234 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "KnowledgeBaseProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [KnowledgeBases][google.cloud.dialogflow.v2.KnowledgeBase]. +service KnowledgeBases { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all knowledge bases of the specified agent. + rpc ListKnowledgeBases(ListKnowledgeBasesRequest) returns (ListKnowledgeBasesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/knowledgeBases" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/knowledgeBases" + } + additional_bindings { + get: "/v2/{parent=projects/*/agent}/knowledgeBases" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified knowledge base. + rpc GetKnowledgeBase(GetKnowledgeBaseRequest) returns (KnowledgeBase) { + option (google.api.http) = { + get: "/v2/{name=projects/*/knowledgeBases/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/knowledgeBases/*}" + } + additional_bindings { + get: "/v2/{name=projects/*/agent/knowledgeBases/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a knowledge base. + rpc CreateKnowledgeBase(CreateKnowledgeBaseRequest) returns (KnowledgeBase) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/knowledgeBases" + body: "knowledge_base" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/knowledgeBases" + body: "knowledge_base" + } + additional_bindings { + post: "/v2/{parent=projects/*/agent}/knowledgeBases" + body: "knowledge_base" + } + }; + option (google.api.method_signature) = "parent,knowledge_base"; + } + + // Deletes the specified knowledge base. + rpc DeleteKnowledgeBase(DeleteKnowledgeBaseRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/knowledgeBases/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/knowledgeBases/*}" + } + additional_bindings { + delete: "/v2/{name=projects/*/agent/knowledgeBases/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Updates the specified knowledge base. + rpc UpdateKnowledgeBase(UpdateKnowledgeBaseRequest) returns (KnowledgeBase) { + option (google.api.http) = { + patch: "/v2/{knowledge_base.name=projects/*/knowledgeBases/*}" + body: "knowledge_base" + additional_bindings { + patch: "/v2/{knowledge_base.name=projects/*/locations/*/knowledgeBases/*}" + body: "knowledge_base" + } + additional_bindings { + patch: "/v2/{knowledge_base.name=projects/*/agent/knowledgeBases/*}" + body: "knowledge_base" + } + }; + option (google.api.method_signature) = "knowledge_base,update_mask"; + } +} + +// A knowledge base represents a collection of knowledge documents that you +// provide to Dialogflow. Your knowledge documents contain information that may +// be useful during conversations with end-users. Some Dialogflow features use +// knowledge bases when looking for a response to an end-user input. +// +// For more information, see the [knowledge base +// guide](https://cloud.google.com/dialogflow/docs/how/knowledge-bases). +// +// Note: The `projects.agent.knowledgeBases` resource is deprecated; +// only use `projects.knowledgeBases`. +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//locations//knowledgeBases/`. + string name = 1; + + // Required. The display name of the knowledge base. The name must be 1024 + // bytes or less; otherwise, the creation request fails. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Language which represents the KnowledgeBase. When the KnowledgeBase is + // created/updated, expect this to be present for non en-us languages. When + // unspecified, the default language code en-us applies. + string language_code = 4; +} + +// Request message for [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2.KnowledgeBases.ListKnowledgeBases]. +message ListKnowledgeBasesRequest { + // Required. The project to list of knowledge bases for. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/KnowledgeBase" + } + ]; + + // The maximum number of items to return in a single page. By + // default 10 and at most 100. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// Response message for [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2.KnowledgeBases.ListKnowledgeBases]. +message ListKnowledgeBasesResponse { + // The list of knowledge bases. + repeated KnowledgeBase knowledge_bases = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// Request message for [KnowledgeBases.GetKnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBases.GetKnowledgeBase]. +message GetKnowledgeBaseRequest { + // Required. The name of the knowledge base to retrieve. + // Format `projects//locations//knowledgeBases/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/KnowledgeBase" + } + ]; +} + +// Request message for [KnowledgeBases.CreateKnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBases.CreateKnowledgeBase]. +message CreateKnowledgeBaseRequest { + // Required. The project to create a knowledge base for. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/KnowledgeBase" + } + ]; + + // Required. The knowledge base to create. + KnowledgeBase knowledge_base = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for [KnowledgeBases.DeleteKnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBases.DeleteKnowledgeBase]. +message DeleteKnowledgeBaseRequest { + // Required. The name of the knowledge base to delete. + // Format: `projects//locations//knowledgeBases/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/KnowledgeBase" + } + ]; + + // Optional. Force deletes the knowledge base. When set to true, any documents + // in the knowledge base are also deleted. + bool force = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [KnowledgeBases.UpdateKnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBases.UpdateKnowledgeBase]. +message UpdateKnowledgeBaseRequest { + // Required. The knowledge base to update. + KnowledgeBase knowledge_base = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Not specified means `update all`. + // Currently, only `display_name` can be updated, an InvalidArgument will be + // returned for attempting to update other fields. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/participant.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/participant.proto new file mode 100644 index 00000000..f815d819 --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/participant.proto @@ -0,0 +1,611 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/audio_config.proto"; +import "google/cloud/dialogflow/v2/session.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ParticipantProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [Participants][google.cloud.dialogflow.v2.Participant]. +service Participants { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Creates a new participant in a conversation. + rpc CreateParticipant(CreateParticipantRequest) returns (Participant) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/conversations/*}/participants" + body: "participant" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/conversations/*}/participants" + body: "participant" + } + }; + option (google.api.method_signature) = "parent,participant"; + } + + // Retrieves a conversation participant. + rpc GetParticipant(GetParticipantRequest) returns (Participant) { + option (google.api.http) = { + get: "/v2/{name=projects/*/conversations/*/participants/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/conversations/*/participants/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Returns the list of all participants in the specified conversation. + rpc ListParticipants(ListParticipantsRequest) returns (ListParticipantsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/conversations/*}/participants" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/conversations/*}/participants" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Updates the specified participant. + rpc UpdateParticipant(UpdateParticipantRequest) returns (Participant) { + option (google.api.http) = { + patch: "/v2/{participant.name=projects/*/conversations/*/participants/*}" + body: "participant" + additional_bindings { + patch: "/v2/{participant.name=projects/*/locations/*/conversations/*/participants/*}" + body: "participant" + } + }; + option (google.api.method_signature) = "participant,update_mask"; + } + + // Adds a text (chat, for example), or audio (phone recording, for example) + // message from a participant into the conversation. + // + // Note: Always use agent versions for production traffic + // sent to virtual agents. See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + rpc AnalyzeContent(AnalyzeContentRequest) returns (AnalyzeContentResponse) { + option (google.api.http) = { + post: "/v2/{participant=projects/*/conversations/*/participants/*}:analyzeContent" + body: "*" + additional_bindings { + post: "/v2/{participant=projects/*/locations/*/conversations/*/participants/*}:analyzeContent" + body: "*" + } + }; + option (google.api.method_signature) = "participant,text_input"; + option (google.api.method_signature) = "participant,event_input"; + } + + // Gets suggested articles for a participant based on specific historical + // messages. + rpc SuggestArticles(SuggestArticlesRequest) returns (SuggestArticlesResponse) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestArticles" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestArticles" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Gets suggested faq answers for a participant based on specific historical + // messages. + rpc SuggestFaqAnswers(SuggestFaqAnswersRequest) returns (SuggestFaqAnswersResponse) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + } +} + +// Represents a conversation participant (human agent, virtual agent, end-user). +message Participant { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Participant" + pattern: "projects/{project}/conversations/{conversation}/participants/{participant}" + pattern: "projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}" + }; + + // Enumeration of the roles a participant can play in a conversation. + enum Role { + // Participant role not set. + ROLE_UNSPECIFIED = 0; + + // Participant is a human agent. + HUMAN_AGENT = 1; + + // Participant is an automated agent, such as a Dialogflow agent. + AUTOMATED_AGENT = 2; + + // Participant is an end user that has called or chatted with + // Dialogflow services. + END_USER = 3; + } + + // Optional. The unique identifier of this participant. + // Format: `projects//locations//conversations//participants/`. + string name = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Immutable. The role this participant plays in the conversation. This field must be set + // during participant creation and is then immutable. + Role role = 2 [(google.api.field_behavior) = IMMUTABLE]; + + // Optional. Label applied to streams representing this participant in SIPREC + // XML metadata and SDP. This is used to assign transcriptions from that + // media stream to this participant. This field can be updated. + string sip_recording_media_label = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents a message posted into a conversation. +message Message { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Message" + pattern: "projects/{project}/conversations/{conversation}/messages/{message}" + pattern: "projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}" + }; + + // The unique identifier of the message. + // Format: `projects//locations//conversations//messages/`. + string name = 1; + + // Required. The message content. + string content = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The message language. + // This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + // language tag. Example: "en-US". + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The participant that sends this message. + string participant = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The role of the participant. + Participant.Role participant_role = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the message was created. + google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The annotation for the message. + MessageAnnotation message_annotation = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request message for [Participants.CreateParticipant][google.cloud.dialogflow.v2.Participants.CreateParticipant]. +message CreateParticipantRequest { + // Required. Resource identifier of the conversation adding the participant. + // Format: `projects//locations//conversations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Participant" + } + ]; + + // Required. The participant to create. + Participant participant = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Participants.GetParticipant][google.cloud.dialogflow.v2.Participants.GetParticipant]. +message GetParticipantRequest { + // Required. The name of the participant. Format: + // `projects//locations//conversations//participants/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; +} + +// The request message for [Participants.ListParticipants][google.cloud.dialogflow.v2.Participants.ListParticipants]. +message ListParticipantsRequest { + // Required. The conversation to list all participants from. + // Format: `projects//locations//conversations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Participant" + } + ]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Participants.ListParticipants][google.cloud.dialogflow.v2.Participants.ListParticipants]. +message ListParticipantsResponse { + // The list of participants. There is a maximum number of items + // returned based on the page_size field in the request. + repeated Participant participants = 1; + + // Token to retrieve the next page of results or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [Participants.UpdateParticipant][google.cloud.dialogflow.v2.Participants.UpdateParticipant]. +message UpdateParticipantRequest { + // Required. The participant to update. + Participant participant = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to specify which fields to update. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent]. +message AnalyzeContentRequest { + // Required. The name of the participant this text comes from. + // Format: `projects//locations//conversations//participants/`. + string participant = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; + + // Required. The input content. + oneof input { + // The natural language text to be processed. + TextInput text_input = 6; + + // An input event to send to Dialogflow. + EventInput event_input = 8; + } + + // Speech synthesis configuration. + // The speech synthesis settings for a virtual agent that may be configured + // for the associated conversation profile are not used when calling + // AnalyzeContent. If this configuration is not supplied, speech synthesis + // is disabled. + OutputAudioConfig reply_audio_config = 5; + + // Parameters for a Dialogflow virtual-agent query. + QueryParameters query_params = 9; + + // A unique identifier for this request. Restricted to 36 ASCII characters. + // A random UUID is recommended. + // This request is only idempotent if a `request_id` is provided. + string request_id = 11; +} + +// The message in the response that indicates the parameters of DTMF. +message DtmfParameters { + // Indicates whether DTMF input can be handled in the next request. + bool accepts_dtmf_input = 1; +} + +// The response message for [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent]. +message AnalyzeContentResponse { + // The output text content. + // This field is set if the automated agent responded with text to show to + // the user. + string reply_text = 1; + + // The audio data bytes encoded as specified in the request. + // This field is set if: + // + // - `reply_audio_config` was specified in the request, or + // - The automated agent responded with audio to play to the user. In such + // case, `reply_audio.config` contains settings used to synthesize the + // speech. + // + // In some scenarios, multiple output audio fields may be present in the + // response structure. In these cases, only the top-most-level audio output + // has content. + OutputAudio reply_audio = 2; + + // Only set if a Dialogflow automated agent has responded. + // Note that: [AutomatedAgentReply.detect_intent_response.output_audio][] + // and [AutomatedAgentReply.detect_intent_response.output_audio_config][] + // are always empty, use [reply_audio][google.cloud.dialogflow.v2.AnalyzeContentResponse.reply_audio] instead. + AutomatedAgentReply automated_agent_reply = 3; + + // Message analyzed by CCAI. + Message message = 5; + + // The suggestions for most recent human agent. The order is the same as + // [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.feature_configs] of + // [HumanAgentAssistantConfig.human_agent_suggestion_config][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.human_agent_suggestion_config]. + repeated SuggestionResult human_agent_suggestion_results = 6; + + // The suggestions for end user. The order is the same as + // [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.feature_configs] of + // [HumanAgentAssistantConfig.end_user_suggestion_config][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.end_user_suggestion_config]. + repeated SuggestionResult end_user_suggestion_results = 7; + + // Indicates the parameters of DTMF. + DtmfParameters dtmf_parameters = 9; +} + +// The request message for [Participants.SuggestArticles][google.cloud.dialogflow.v2.Participants.SuggestArticles]. +message SuggestArticlesRequest { + // Required. The name of the participant to fetch suggestion for. + // Format: `projects//locations//conversations//participants/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; + + // The name of the latest conversation message to compile suggestion + // for. If empty, it will be the latest message of the conversation. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Message" + }]; + + // Max number of messages prior to and including + // [latest_message][google.cloud.dialogflow.v2.SuggestArticlesRequest.latest_message] to use as context + // when compiling the suggestion. By default 20 and at most 50. + int32 context_size = 3; +} + +// The response message for [Participants.SuggestArticles][google.cloud.dialogflow.v2.Participants.SuggestArticles]. +message SuggestArticlesResponse { + // Articles ordered by score in descending order. + repeated ArticleAnswer article_answers = 1; + + // The name of the latest conversation message used to compile + // suggestion for. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2; + + // Number of messages prior to and including + // [latest_message][google.cloud.dialogflow.v2.SuggestArticlesResponse.latest_message] to compile the + // suggestion. It may be smaller than the + // [SuggestArticlesRequest.context_size][google.cloud.dialogflow.v2.SuggestArticlesRequest.context_size] field in the request if there + // aren't that many messages in the conversation. + int32 context_size = 3; +} + +// The request message for [Participants.SuggestFaqAnswers][google.cloud.dialogflow.v2.Participants.SuggestFaqAnswers]. +message SuggestFaqAnswersRequest { + // Required. The name of the participant to fetch suggestion for. + // Format: `projects//locations//conversations//participants/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; + + // The name of the latest conversation message to compile suggestion + // for. If empty, it will be the latest message of the conversation. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Message" + }]; + + // Max number of messages prior to and including + // [latest_message] to use as context when compiling the + // suggestion. By default 20 and at most 50. + int32 context_size = 3; +} + +// The request message for [Participants.SuggestFaqAnswers][google.cloud.dialogflow.v2.Participants.SuggestFaqAnswers]. +message SuggestFaqAnswersResponse { + // Answers extracted from FAQ documents. + repeated FaqAnswer faq_answers = 1; + + // The name of the latest conversation message used to compile + // suggestion for. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2; + + // Number of messages prior to and including + // [latest_message][google.cloud.dialogflow.v2.SuggestFaqAnswersResponse.latest_message] to compile the + // suggestion. It may be smaller than the + // [SuggestFaqAnswersRequest.context_size][google.cloud.dialogflow.v2.SuggestFaqAnswersRequest.context_size] field in the request if there + // aren't that many messages in the conversation. + int32 context_size = 3; +} + +// Represents the natural language speech audio to be played to the end user. +message OutputAudio { + // Instructs the speech synthesizer how to generate the speech + // audio. + OutputAudioConfig config = 1; + + // The natural language speech audio. + bytes audio = 2; +} + +// Represents a response from an automated agent. +message AutomatedAgentReply { + // Represents different automated agent reply types. + enum AutomatedAgentReplyType { + // Not specified. This should never happen. + AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED = 0; + + // Partial reply. e.g. Aggregated responses in a `Fulfillment` that enables + // `return_partial_response` can be returned as partial reply. + // WARNING: partial reply is not eligible for barge-in. + PARTIAL = 1; + + // Final reply. + FINAL = 2; + } + + // Response of the Dialogflow [Sessions.DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] call. + DetectIntentResponse detect_intent_response = 1; + + // AutomatedAgentReply type. + AutomatedAgentReplyType automated_agent_reply_type = 7; + + // Indicates whether the partial automated agent reply is interruptible when a + // later reply message arrives. e.g. if the agent specified some music as + // partial response, it can be cancelled. + bool allow_cancellation = 8; +} + +// Represents article answer. +message ArticleAnswer { + // The article title. + string title = 1; + + // The article URI. + string uri = 2; + + // Article snippets. + repeated string snippets = 3; + + // Article match confidence. + // The system's confidence score that this article is a good match for this + // conversation, as a value from 0.0 (completely uncertain) to 1.0 + // (completely certain). + float confidence = 4; + + // A map that contains metadata about the answer and the + // document from which it originates. + map metadata = 5; + + // The name of answer record, in the format of + // "projects//locations//answerRecords/" + string answer_record = 6; +} + +// Represents answer from "frequently asked questions". +message FaqAnswer { + // The piece of text from the `source` knowledge base document. + string answer = 1; + + // The system's confidence score that this Knowledge answer is a good match + // for this conversational query, range from 0.0 (completely uncertain) + // to 1.0 (completely certain). + float confidence = 2; + + // The corresponding FAQ question. + string question = 3; + + // Indicates which Knowledge Document this answer was extracted + // from. + // Format: `projects//locations//agent/knowledgeBases//documents/`. + string source = 4; + + // A map that contains metadata about the answer and the + // document from which it originates. + map metadata = 5; + + // The name of answer record, in the format of + // "projects//locations//answerRecords/" + string answer_record = 6; +} + +// One response of different type of suggestion response which is used in +// the response of [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] and +// [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent], as well as [HumanAgentAssistantEvent][google.cloud.dialogflow.v2.HumanAgentAssistantEvent]. +message SuggestionResult { + // Different type of suggestion response. + oneof suggestion_response { + // Error status if the request failed. + google.rpc.Status error = 1; + + // SuggestArticlesResponse if request is for ARTICLE_SUGGESTION. + SuggestArticlesResponse suggest_articles_response = 2; + + // SuggestFaqAnswersResponse if request is for FAQ_ANSWER. + SuggestFaqAnswersResponse suggest_faq_answers_response = 3; + } +} + +// Represents a part of a message possibly annotated with an entity. The part +// can be an entity or purely a part of the message between two entities or +// message start/end. +message AnnotatedMessagePart { + // A part of a message possibly annotated with an entity. + string text = 1; + + // The [Dialogflow system entity + // type](https://cloud.google.com/dialogflow/docs/reference/system-entities) + // of this message part. If this is empty, Dialogflow could not annotate the + // phrase part with a system entity. + string entity_type = 2; + + // The [Dialogflow system entity formatted value + // ](https://cloud.google.com/dialogflow/docs/reference/system-entities) of + // this message part. For example for a system entity of type + // `@sys.unit-currency`, this may contain: + //
+  // {
+  //   "amount": 5,
+  //   "currency": "USD"
+  // }
+  // 
+ google.protobuf.Value formatted_value = 3; +} + +// Represents the result of annotation for the message. +message MessageAnnotation { + // The collection of annotated message parts ordered by their + // position in the message. You can recover the annotated message by + // concatenating [AnnotatedMessagePart.text]. + repeated AnnotatedMessagePart parts = 1; + + // Indicates whether the text message contains entities. + bool contain_entities = 2; +} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/session.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/session.proto new file mode 100644 index 00000000..b4290f33 --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/session.proto @@ -0,0 +1,672 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/audio_config.proto"; +import "google/cloud/dialogflow/v2/context.proto"; +import "google/cloud/dialogflow/v2/intent.proto"; +import "google/cloud/dialogflow/v2/session_entity_type.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/rpc/status.proto"; +import "google/type/latlng.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "SessionProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; +option (google.api.resource_definition) = { + type: "dialogflow.googleapis.com/Session" + pattern: "projects/{project}/agent/sessions/{session}" + pattern: "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}" + pattern: "projects/{project}/locations/{location}/agent/sessions/{session}" + pattern: "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}" +}; + +// A service used for session interactions. +// +// For more information, see the [API interactions +// guide](https://cloud.google.com/dialogflow/docs/api-overview). +service Sessions { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Processes a natural language query and returns structured, actionable data + // as a result. This method is not idempotent, because it may cause contexts + // and session entity types to be updated, which in turn might affect + // results of future queries. + // + // 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: "/v2/{session=projects/*/agent/sessions/*}:detectIntent" + body: "*" + additional_bindings { + post: "/v2/{session=projects/*/agent/environments/*/users/*/sessions/*}:detectIntent" + body: "*" + } + additional_bindings { + post: "/v2/{session=projects/*/locations/*/agent/sessions/*}:detectIntent" + body: "*" + } + additional_bindings { + post: "/v2/{session=projects/*/locations/*/agent/environments/*/users/*/sessions/*}:detectIntent" + body: "*" + } + }; + option (google.api.method_signature) = "session,query_input"; + } + + // 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) { + } +} + +// The request to detect user's intent. +message DetectIntentRequest { + // Required. The name of the session this query is sent to. Format: + // `projects//agent/sessions/`, or + // `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume + // default 'draft' environment (`Environment ID` might be referred to as + // environment name at some places). If `User ID` is not specified, we are + // using "-". It's up to the API caller to choose an appropriate `Session ID` + // and `User Id`. They can be a random number or some type of user and session + // identifiers (preferably hashed). 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) = { + type: "dialogflow.googleapis.com/Session" + } + ]; + + // The parameters of this query. + QueryParameters query_params = 2; + + // Required. The input specification. It can be set to: + // + // 1. an audio config + // which instructs the speech recognizer how to process the speech audio, + // + // 2. a conversational query in the form of text, or + // + // 3. an event that specifies which intent to trigger. + QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; + + // Instructs the speech synthesizer how to generate the output + // audio. If this field is not set and agent-level speech synthesizer is not + // configured, no output audio is generated. + OutputAudioConfig output_audio_config = 4; + + // Mask for [output_audio_config][google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config] indicating which settings in this + // request-level config should override speech synthesizer settings defined at + // agent-level. + // + // If unspecified or empty, [output_audio_config][google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config] replaces the agent-level + // config in its entirety. + google.protobuf.FieldMask output_audio_config_mask = 7; + + // The natural language speech audio to be processed. This field + // should be populated iff `query_input` is set to an input audio config. + // A single request can contain up to 1 minute of speech audio data. + bytes input_audio = 5; +} + +// The message returned from the DetectIntent method. +message DetectIntentResponse { + // The unique identifier of the response. It can be used to + // locate a response in the training example set or for reporting issues. + string response_id = 1; + + // The selected results of the conversational query or event processing. + // See `alternative_query_results` for additional potential results. + QueryResult query_result = 2; + + // Specifies the status of the webhook request. + google.rpc.Status webhook_status = 3; + + // The audio data bytes encoded as specified in the request. + // Note: The output audio is generated based on the values of default platform + // text responses found in the `query_result.fulfillment_messages` field. If + // multiple default text responses exist, they will be concatenated when + // generating audio. If no default platform text responses exist, the + // generated audio content will be empty. + // + // In some scenarios, multiple output audio fields may be present in the + // response structure. In these cases, only the top-most-level audio output + // has content. + bytes output_audio = 4; + + // The config used by the speech synthesizer to generate the output audio. + OutputAudioConfig output_audio_config = 6; +} + +// Represents the parameters of the conversational query. +message QueryParameters { + // The time zone of this conversational query from the + // [time zone database](https://www.iana.org/time-zones), e.g., + // America/New_York, Europe/Paris. If not provided, the time zone specified in + // agent settings is used. + string time_zone = 1; + + // The geo location of this conversational query. + google.type.LatLng geo_location = 2; + + // The collection of contexts to be activated before this query is + // executed. + repeated Context contexts = 3; + + // Specifies whether to delete all contexts in the current session + // before the new ones are activated. + bool reset_contexts = 4; + + // Additional session entity types to replace or extend developer + // entity types with. The entity synonyms apply to all languages and persist + // for the session of this query. + repeated SessionEntityType session_entity_types = 5; + + // This field can be used to pass custom data to your webhook. + // Arbitrary JSON objects are supported. + // If supplied, the value is used to populate the + // `WebhookRequest.original_detect_intent_request.payload` + // field sent to your webhook. + google.protobuf.Struct payload = 6; + + // Configures the type of sentiment analysis to perform. If not + // provided, sentiment analysis is not performed. + SentimentAnalysisRequestConfig sentiment_analysis_request_config = 10; + + // This field can be used to pass HTTP headers for a webhook + // call. These headers will be sent to webhook along with the headers that + // have been configured through the Dialogflow web console. The headers + // defined within this field will overwrite the headers configured through the + // Dialogflow console if there is a conflict. Header names are + // case-insensitive. Google's specified headers are not allowed. Including: + // "Host", "Content-Length", "Connection", "From", "User-Agent", + // "Accept-Encoding", "If-Modified-Since", "If-None-Match", "X-Forwarded-For", + // etc. + map webhook_headers = 14; +} + +// Represents the query input. It can contain either: +// +// 1. An audio config which +// instructs the speech recognizer how to process the speech audio. +// +// 2. A conversational query in the form of text,. +// +// 3. An event that specifies which intent to trigger. +message QueryInput { + // Required. The input specification. + oneof input { + // Instructs the speech recognizer how to process the speech audio. + InputAudioConfig audio_config = 1; + + // The natural language text to be processed. + TextInput text = 2; + + // The event to be processed. + EventInput event = 3; + } +} + +// Represents the result of conversational query or event processing. +message QueryResult { + // The original conversational query text: + // + // - If natural language text was provided as input, `query_text` contains + // a copy of the input. + // - If natural language speech audio was provided as input, `query_text` + // contains the speech recognition result. If speech recognizer produced + // multiple alternatives, a particular one is picked. + // - If automatic spell correction is enabled, `query_text` will contain the + // corrected user input. + string query_text = 1; + + // The language that was triggered during intent detection. + // See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. + string language_code = 15; + + // The Speech recognition confidence between 0.0 and 1.0. A higher number + // indicates an estimated greater likelihood that the recognized words are + // correct. The default of 0.0 is a sentinel value indicating that confidence + // was not set. + // + // This field is not guaranteed to be accurate or set. In particular this + // field isn't set for StreamingDetectIntent since the streaming endpoint has + // separate confidence estimates per portion of the audio in + // StreamingRecognitionResult. + float speech_recognition_confidence = 2; + + // The action name from the matched intent. + string action = 3; + + // The collection of extracted parameters. + // + // Depending on your protocol or client library language, this is a + // map, associative array, symbol table, dictionary, or JSON object + // composed of a collection of (MapKey, MapValue) pairs: + // + // - MapKey type: string + // - MapKey value: parameter name + // - MapValue type: + // - If parameter's entity type is a composite entity: map + // - Else: depending on parameter value type, could be one of string, + // number, boolean, null, list or map + // - MapValue value: + // - If parameter's entity type is a composite entity: + // map from composite entity property names to property values + // - Else: parameter value + google.protobuf.Struct parameters = 4; + + // This field is set to: + // + // - `false` if the matched intent has required parameters and not all of + // the required parameter values have been collected. + // - `true` if all required parameter values have been collected, or if the + // matched intent doesn't contain any required parameters. + bool all_required_params_present = 5; + + // Indicates whether the conversational query triggers a cancellation for slot + // filling. + bool cancels_slot_filling = 21; + + // The text to be pronounced to the user or shown on the screen. + // Note: This is a legacy field, `fulfillment_messages` should be preferred. + string fulfillment_text = 6; + + // The collection of rich messages to present to the user. + repeated Intent.Message fulfillment_messages = 7; + + // If the query was fulfilled by a webhook call, this field is set to the + // value of the `source` field returned in the webhook response. + string webhook_source = 8; + + // If the query was fulfilled by a webhook call, this field is set to the + // value of the `payload` field returned in the webhook response. + google.protobuf.Struct webhook_payload = 9; + + // The collection of output contexts. If applicable, + // `output_contexts.parameters` contains entries with name + // `.original` containing the original parameter values + // before the query. + repeated Context output_contexts = 10; + + // The intent that matched the conversational query. Some, not + // all fields are filled in this message, including but not limited to: + // `name`, `display_name`, `end_interaction` and `is_fallback`. + Intent intent = 11; + + // The intent detection confidence. Values range from 0.0 + // (completely uncertain) to 1.0 (completely certain). + // This value is for informational purpose only and is only used to + // help match the best intent within the classification threshold. + // This value may change for the same end-user expression at any time due to a + // model retraining or change in implementation. + // If there are `multiple knowledge_answers` messages, this value is set to + // the greatest `knowledgeAnswers.match_confidence` value in the list. + float intent_detection_confidence = 12; + + // Free-form diagnostic information for the associated detect intent request. + // The fields of this data can change without notice, so you should not write + // code that depends on its structure. + // The data may contain: + // + // - webhook call latency + // - webhook errors + google.protobuf.Struct diagnostic_info = 14; + + // The sentiment analysis result, which depends on the + // `sentiment_analysis_request_config` specified in the request. + SentimentAnalysisResult sentiment_analysis_result = 17; +} + +// The top-level message sent by the client to the +// [Sessions.StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent] method. +// +// Multiple request messages should be sent in order: +// +// 1. The first message must contain +// [session][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.session], +// [query_input][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input] plus optionally +// [query_params][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_params]. If the client +// wants to receive an audio response, it should also contain +// [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config]. +// The message must not contain +// [input_audio][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio]. +// 2. If [query_input][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input] was set to +// [query_input.audio_config][google.cloud.dialogflow.v2.InputAudioConfig], all subsequent +// messages must contain +// [input_audio][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio] to continue with +// Speech recognition. +// If you decide to rather detect an intent from text input after you +// already started Speech recognition, please send a message with +// [query_input.text][google.cloud.dialogflow.v2.QueryInput.text]. +// +// However, note that: +// +// * Dialogflow will bill you for the audio duration so far. +// * Dialogflow discards all Speech recognition results in favor of the +// input text. +// * Dialogflow will use the language code from the first message. +// +// After you sent all input, you must half-close or abort the request stream. +message StreamingDetectIntentRequest { + // Required. The name of the session the query is sent to. + // Format of the session name: + // `projects//agent/sessions/`, or + // `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume + // default 'draft' environment. If `User ID` is not specified, we are using + // "-". It's up to the API caller to choose an appropriate `Session ID` and + // `User Id`. They can be a random number or some type of user and session + // identifiers (preferably hashed). 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) = { + type: "dialogflow.googleapis.com/Session" + } + ]; + + // The parameters of this query. + QueryParameters query_params = 2; + + // Required. The input specification. It can be set to: + // + // 1. an audio config which instructs the speech recognizer how to process + // the speech audio, + // + // 2. a conversational query in the form of text, or + // + // 3. an event that specifies which intent to trigger. + QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; + + // Please use [InputAudioConfig.single_utterance][google.cloud.dialogflow.v2.InputAudioConfig.single_utterance] instead. + // If `false` (default), recognition does not cease until + // the client closes the stream. If `true`, the recognizer will detect a + // single spoken utterance in input audio. Recognition ceases when it detects + // the audio's voice has stopped or paused. In this case, once a detected + // intent is received, the client should close the stream and start a new + // request with a new stream as needed. + // This setting is ignored when `query_input` is a piece of text or an event. + bool single_utterance = 4 [deprecated = true]; + + // Instructs the speech synthesizer how to generate the output + // audio. If this field is not set and agent-level speech synthesizer is not + // configured, no output audio is generated. + OutputAudioConfig output_audio_config = 5; + + // Mask for [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config] indicating which settings in this + // request-level config should override speech synthesizer settings defined at + // agent-level. + // + // If unspecified or empty, [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config] replaces the agent-level + // config in its entirety. + google.protobuf.FieldMask output_audio_config_mask = 7; + + // The input audio content to be recognized. Must be sent if + // `query_input` was set to a streaming input audio config. The complete audio + // over all streaming messages must not exceed 1 minute. + bytes input_audio = 6; +} + +// The top-level message returned from the +// `StreamingDetectIntent` method. +// +// Multiple response messages can be returned in order: +// +// 1. If the input was set to streaming audio, the first one or more messages +// contain `recognition_result`. Each `recognition_result` represents a more +// complete transcript of what the user said. The last `recognition_result` +// has `is_final` set to `true`. +// +// 2. The next message contains `response_id`, `query_result` +// and optionally `webhook_status` if a WebHook was called. +message StreamingDetectIntentResponse { + // The unique identifier of the response. It can be used to + // locate a response in the training example set or for reporting issues. + string response_id = 1; + + // The result of speech recognition. + StreamingRecognitionResult recognition_result = 2; + + // The result of the conversational query or event processing. + QueryResult query_result = 3; + + // Specifies the status of the webhook request. + google.rpc.Status webhook_status = 4; + + // The audio data bytes encoded as specified in the request. + // Note: The output audio is generated based on the values of default platform + // text responses found in the `query_result.fulfillment_messages` field. If + // multiple default text responses exist, they will be concatenated when + // generating audio. If no default platform text responses exist, the + // generated audio content will be empty. + // + // In some scenarios, multiple output audio fields may be present in the + // response structure. In these cases, only the top-most-level audio output + // has content. + bytes output_audio = 5; + + // The config used by the speech synthesizer to generate the output audio. + OutputAudioConfig output_audio_config = 6; +} + +// Contains a speech recognition result corresponding to a portion of the audio +// that is currently being processed or an indication that this is the end +// of the single requested utterance. +// +// Example: +// +// 1. transcript: "tube" +// +// 2. transcript: "to be a" +// +// 3. transcript: "to be" +// +// 4. transcript: "to be or not to be" +// is_final: true +// +// 5. transcript: " that's" +// +// 6. transcript: " that is" +// +// 7. message_type: `END_OF_SINGLE_UTTERANCE` +// +// 8. transcript: " that is the question" +// is_final: true +// +// Only two of the responses contain final results (#4 and #8 indicated by +// `is_final: true`). Concatenating these generates the full transcript: "to be +// or not to be that is the question". +// +// In each response we populate: +// +// * for `TRANSCRIPT`: `transcript` and possibly `is_final`. +// +// * for `END_OF_SINGLE_UTTERANCE`: only `message_type`. +message StreamingRecognitionResult { + // Type of the response message. + enum MessageType { + // Not specified. Should never be used. + MESSAGE_TYPE_UNSPECIFIED = 0; + + // Message contains a (possibly partial) transcript. + TRANSCRIPT = 1; + + // Event indicates that the server has detected the end of the user's speech + // utterance and expects no additional inputs. + // Therefore, the server will not process additional audio (although it may subsequently return additional results). The + // client should stop sending additional audio data, half-close the gRPC + // connection, and wait for any additional results until the server closes + // the gRPC connection. This message is only sent if `single_utterance` was + // set to `true`, and is not used otherwise. + END_OF_SINGLE_UTTERANCE = 2; + } + + // Type of the result message. + MessageType message_type = 1; + + // Transcript text representing the words that the user spoke. + // Populated if and only if `message_type` = `TRANSCRIPT`. + string transcript = 2; + + // If `false`, the `StreamingRecognitionResult` represents an + // interim result that may change. If `true`, the recognizer will not return + // any further hypotheses about this piece of the audio. May only be populated + // for `message_type` = `TRANSCRIPT`. + bool is_final = 3; + + // The Speech confidence between 0.0 and 1.0 for the current portion of audio. + // A higher number indicates an estimated greater likelihood that the + // recognized words are correct. The default of 0.0 is a sentinel value + // indicating that confidence was not set. + // + // This field is typically only provided if `is_final` is true and you should + // not rely on it being accurate or even set. + float confidence = 4; + + // Word-specific information for the words recognized by Speech in + // [transcript][google.cloud.dialogflow.v2.StreamingRecognitionResult.transcript]. Populated if and only if `message_type` = `TRANSCRIPT` and + // [InputAudioConfig.enable_word_info] is set. + repeated SpeechWordInfo speech_word_info = 7; + + // Time offset of the end of this Speech recognition result relative to the + // beginning of the audio. Only populated for `message_type` = `TRANSCRIPT`. + google.protobuf.Duration speech_end_offset = 8; + + // Detected language code for the transcript. + string language_code = 10; +} + +// Represents the natural language text to be processed. +message TextInput { + // Required. The UTF-8 encoded natural language text to be processed. + // Text length must not exceed 256 characters. + string text = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The language of this conversational query. See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. Note that queries in + // the same session do not necessarily need to specify the same language. + string language_code = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Events allow for matching intents by event name instead of the natural +// language input. For instance, input `` can trigger a personalized welcome response. +// The parameter `name` may be used by the agent in the response: +// `"Hello #welcome_event.name! What can I do for you today?"`. +message EventInput { + // Required. The unique identifier of the event. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // The collection of parameters associated with the event. + // + // Depending on your protocol or client library language, this is a + // map, associative array, symbol table, dictionary, or JSON object + // composed of a collection of (MapKey, MapValue) pairs: + // + // - MapKey type: string + // - MapKey value: parameter name + // - MapValue type: + // - If parameter's entity type is a composite entity: map + // - Else: depending on parameter value type, could be one of string, + // number, boolean, null, list or map + // - MapValue value: + // - If parameter's entity type is a composite entity: + // map from composite entity property names to property values + // - Else: parameter value + google.protobuf.Struct parameters = 2; + + // Required. The language of this query. See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. Note that queries in + // the same session do not necessarily need to specify the same language. + string language_code = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Configures the types of sentiment analysis to perform. +message SentimentAnalysisRequestConfig { + // Instructs the service to perform sentiment analysis on + // `query_text`. If not provided, sentiment analysis is not performed on + // `query_text`. + bool analyze_query_text_sentiment = 1; +} + +// The result of sentiment analysis. Sentiment analysis inspects user input +// and identifies the prevailing subjective opinion, especially to determine a +// user's attitude as positive, negative, or neutral. +// For [Participants.DetectIntent][], it needs to be configured in +// [DetectIntentRequest.query_params][google.cloud.dialogflow.v2.DetectIntentRequest.query_params]. For +// [Participants.StreamingDetectIntent][], it needs to be configured in +// [StreamingDetectIntentRequest.query_params][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_params]. +// And for [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] and +// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent], it needs to be configured in +// [ConversationProfile.human_agent_assistant_config][google.cloud.dialogflow.v2.ConversationProfile.human_agent_assistant_config] +message SentimentAnalysisResult { + // The sentiment analysis result for `query_text`. + Sentiment query_text_sentiment = 1; +} + +// The sentiment, such as positive/negative feeling or association, for a unit +// of analysis, such as the query text. +message Sentiment { + // Sentiment score between -1.0 (negative sentiment) and 1.0 (positive + // sentiment). + float score = 1; + + // A non-negative number in the [0, +inf) range, which represents the absolute + // magnitude of sentiment, regardless of score (positive or negative). + float magnitude = 2; +} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/session_entity_type.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/session_entity_type.proto new file mode 100644 index 00000000..44efa779 --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/session_entity_type.proto @@ -0,0 +1,313 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/entity_type.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "SessionEntityTypeProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [SessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityType]. +service SessionEntityTypes { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all session entity types in the specified session. + // + // This method doesn't work with Google Assistant integration. + // Contact Dialogflow support if you need to use session entities + // with Google Assistant integration. + rpc ListSessionEntityTypes(ListSessionEntityTypesRequest) returns (ListSessionEntityTypesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/agent/sessions/*}/entityTypes" + additional_bindings { + get: "/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes" + } + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/agent/sessions/*}/entityTypes" + } + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified session entity type. + // + // This method doesn't work with Google Assistant integration. + // Contact Dialogflow support if you need to use session entities + // with Google Assistant integration. + rpc GetSessionEntityType(GetSessionEntityTypeRequest) returns (SessionEntityType) { + option (google.api.http) = { + get: "/v2/{name=projects/*/agent/sessions/*/entityTypes/*}" + additional_bindings { + get: "/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + } + additional_bindings { + get: "/v2/{name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" + } + additional_bindings { + get: "/v2/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a session entity type. + // + // If the specified session entity type already exists, overrides the session + // entity type. + // + // This method doesn't work with Google Assistant integration. + // Contact Dialogflow support if you need to use session entities + // with Google Assistant integration. + rpc CreateSessionEntityType(CreateSessionEntityTypeRequest) returns (SessionEntityType) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent/sessions/*}/entityTypes" + body: "session_entity_type" + additional_bindings { + post: "/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes" + body: "session_entity_type" + } + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent/sessions/*}/entityTypes" + body: "session_entity_type" + } + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes" + body: "session_entity_type" + } + }; + option (google.api.method_signature) = "parent,session_entity_type"; + } + + // Updates the specified session entity type. + // + // This method doesn't work with Google Assistant integration. + // Contact Dialogflow support if you need to use session entities + // with Google Assistant integration. + rpc UpdateSessionEntityType(UpdateSessionEntityTypeRequest) returns (SessionEntityType) { + option (google.api.http) = { + patch: "/v2/{session_entity_type.name=projects/*/agent/sessions/*/entityTypes/*}" + body: "session_entity_type" + additional_bindings { + patch: "/v2/{session_entity_type.name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + body: "session_entity_type" + } + additional_bindings { + patch: "/v2/{session_entity_type.name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" + body: "session_entity_type" + } + additional_bindings { + patch: "/v2/{session_entity_type.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + body: "session_entity_type" + } + }; + option (google.api.method_signature) = "session_entity_type"; + option (google.api.method_signature) = "session_entity_type,update_mask"; + } + + // Deletes the specified session entity type. + // + // This method doesn't work with Google Assistant integration. + // Contact Dialogflow support if you need to use session entities + // with Google Assistant integration. + rpc DeleteSessionEntityType(DeleteSessionEntityTypeRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/agent/sessions/*/entityTypes/*}" + additional_bindings { + delete: "/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + } + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" + } + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + } + }; + option (google.api.method_signature) = "name"; + } +} + +// A session represents a conversation between a Dialogflow agent and an +// end-user. You can create special entities, called session entities, during a +// session. Session entities can extend or replace custom entity types and only +// exist during the session that they were created for. All session data, +// including session entities, is stored by Dialogflow for 20 minutes. +// +// For more information, see the [session entity +// guide](https://cloud.google.com/dialogflow/docs/entities-session). +message SessionEntityType { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/SessionEntityType" + pattern: "projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}" + pattern: "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}" + pattern: "projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}" + pattern: "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}" + }; + + // The types of modifications for a session entity type. + enum EntityOverrideMode { + // Not specified. This value should be never used. + ENTITY_OVERRIDE_MODE_UNSPECIFIED = 0; + + // The collection of session entities overrides the collection of entities + // in the corresponding custom entity type. + ENTITY_OVERRIDE_MODE_OVERRIDE = 1; + + // The collection of session entities extends the collection of entities in + // the corresponding custom entity type. + // + // Note: Even in this override mode calls to `ListSessionEntityTypes`, + // `GetSessionEntityType`, `CreateSessionEntityType` and + // `UpdateSessionEntityType` only return the additional entities added in + // this session entity type. If you want to get the supplemented list, + // please call [EntityTypes.GetEntityType][google.cloud.dialogflow.v2.EntityTypes.GetEntityType] on the custom entity type + // and merge. + ENTITY_OVERRIDE_MODE_SUPPLEMENT = 2; + } + + // Required. The unique identifier of this session entity type. Format: + // `projects//agent/sessions//entityTypes/`, or `projects//agent/environments//users//sessions//entityTypes/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + // + // `` must be the display name of an existing entity + // type in the same agent that will be overridden or supplemented. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Indicates whether the additional data should override or + // supplement the custom entity type definition. + EntityOverrideMode entity_override_mode = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The collection of entities associated with this session entity + // type. + repeated EntityType.Entity entities = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes]. +message ListSessionEntityTypesRequest { + // Required. The session to list all session entity types from. + // Format: `projects//agent/sessions/` or + // `projects//agent/environments//users// + // sessions/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/SessionEntityType" + } + ]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes]. +message ListSessionEntityTypesResponse { + // The list of session entity types. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated SessionEntityType session_entity_types = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [SessionEntityTypes.GetSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.GetSessionEntityType]. +message GetSessionEntityTypeRequest { + // Required. The name of the session entity type. Format: + // `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/SessionEntityType" + } + ]; +} + +// The request message for [SessionEntityTypes.CreateSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.CreateSessionEntityType]. +message CreateSessionEntityTypeRequest { + // Required. The session to create a session entity type for. + // Format: `projects//agent/sessions/` or + // `projects//agent/environments//users// + // sessions/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/SessionEntityType" + } + ]; + + // Required. The session entity type to create. + SessionEntityType session_entity_type = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [SessionEntityTypes.UpdateSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.UpdateSessionEntityType]. +message UpdateSessionEntityTypeRequest { + // Required. The session entity type to update. + SessionEntityType session_entity_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [SessionEntityTypes.DeleteSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.DeleteSessionEntityType]. +message DeleteSessionEntityTypeRequest { + // Required. The name of the entity type to delete. Format: + // `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/SessionEntityType" + } + ]; +} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/validation_result.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/validation_result.proto new file mode 100644 index 00000000..5b8d2780 --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/validation_result.proto @@ -0,0 +1,76 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ValidationResultProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Represents a single validation error. +message ValidationError { + // Represents a level of severity. + enum Severity { + // Not specified. This value should never be used. + SEVERITY_UNSPECIFIED = 0; + + // The agent doesn't follow Dialogflow best practices. + INFO = 1; + + // The agent may not behave as expected. + WARNING = 2; + + // The agent may experience partial failures. + ERROR = 3; + + // The agent may completely fail. + CRITICAL = 4; + } + + // The severity of the error. + Severity severity = 1; + + // The names of the entries that the error is associated with. + // Format: + // + // - "projects//agent", if the error is associated with the entire + // agent. + // - "projects//agent/intents/", if the error is + // associated with certain intents. + // - "projects//agent/intents//trainingPhrases/", if the + // error is associated with certain intent training phrases. + // - "projects//agent/intents//parameters/", if the error is associated with certain intent parameters. + // - "projects//agent/entities/", if the error is + // associated with certain entities. + repeated string entries = 3; + + // The detailed error message. + string error_message = 4; +} + +// Represents the output of agent validation. +message ValidationResult { + // Contains all validation errors. + repeated ValidationError validation_errors = 1; +} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/version.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/version.proto new file mode 100644 index 00000000..8e8c0011 --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/version.proto @@ -0,0 +1,267 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "VersionProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [Versions][google.cloud.dialogflow.v2.Version]. +service Versions { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all versions of the specified agent. + rpc ListVersions(ListVersionsRequest) returns (ListVersionsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/agent}/versions" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/agent}/versions" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified agent version. + rpc GetVersion(GetVersionRequest) returns (Version) { + option (google.api.http) = { + get: "/v2/{name=projects/*/agent/versions/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/agent/versions/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates an agent version. + // + // The new version points to the agent instance in the "default" environment. + rpc CreateVersion(CreateVersionRequest) returns (Version) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent}/versions" + body: "version" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent}/versions" + body: "version" + } + }; + option (google.api.method_signature) = "parent,version"; + } + + // Updates the specified agent version. + // + // Note that this method does not allow you to update the state of the agent + // the given version points to. It allows you to update only mutable + // properties of the version resource. + rpc UpdateVersion(UpdateVersionRequest) returns (Version) { + option (google.api.http) = { + patch: "/v2/{version.name=projects/*/agent/versions/*}" + body: "version" + additional_bindings { + patch: "/v2/{version.name=projects/*/locations/*/agent/versions/*}" + body: "version" + } + }; + option (google.api.method_signature) = "version,update_mask"; + } + + // Delete the specified agent version. + rpc DeleteVersion(DeleteVersionRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/agent/versions/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/agent/versions/*}" + } + }; + option (google.api.method_signature) = "name"; + } +} + +// You can create multiple versions of your agent and publish them to separate +// environments. +// +// When you edit an agent, you are editing the draft agent. At any point, you +// can save the draft agent as an agent version, which is an immutable snapshot +// of your agent. +// +// When you save the draft agent, it is published to the default environment. +// When you create agent versions, you can publish them to custom environments. +// You can create a variety of custom environments for: +// +// - testing +// - development +// - production +// - etc. +// +// For more information, see the [versions and environments +// guide](https://cloud.google.com/dialogflow/docs/agents-versions). +message Version { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Version" + pattern: "projects/{project}/agent/versions/{version}" + pattern: "projects/{project}/locations/{location}/agent/versions/{version}" + }; + + // The status of a version. + enum VersionStatus { + // Not specified. This value is not used. + VERSION_STATUS_UNSPECIFIED = 0; + + // Version is not ready to serve (e.g. training is in progress). + IN_PROGRESS = 1; + + // Version is ready to serve. + READY = 2; + + // Version training failed. + FAILED = 3; + } + + // Output only. The unique identifier of this agent version. + // Supported formats: + // + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The developer-provided description of this version. + string description = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The sequential number of this version. This field is read-only which means + // it cannot be set by create and update methods. + int32 version_number = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The creation time of this version. This field is read-only, i.e., it cannot + // be set by create and update methods. + google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The status of this version. This field is read-only and cannot be set by + // create and update methods. + VersionStatus status = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request message for [Versions.ListVersions][google.cloud.dialogflow.v2.Versions.ListVersions]. +message ListVersionsRequest { + // Required. The agent to list all versions from. + // Supported formats: + // + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Version" + } + ]; + + // Optional. The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Versions.ListVersions][google.cloud.dialogflow.v2.Versions.ListVersions]. +message ListVersionsResponse { + // The list of agent versions. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Version versions = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [Versions.GetVersion][google.cloud.dialogflow.v2.Versions.GetVersion]. +message GetVersionRequest { + // Required. The name of the version. + // Supported formats: + // + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Version" + } + ]; +} + +// The request message for [Versions.CreateVersion][google.cloud.dialogflow.v2.Versions.CreateVersion]. +message CreateVersionRequest { + // Required. The agent to create a version for. + // Supported formats: + // + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Version" + } + ]; + + // Required. The version to create. + Version version = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Versions.UpdateVersion][google.cloud.dialogflow.v2.Versions.UpdateVersion]. +message UpdateVersionRequest { + // Required. The version to update. + // Supported formats: + // + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` + Version version = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Versions.DeleteVersion][google.cloud.dialogflow.v2.Versions.DeleteVersion]. +message DeleteVersionRequest { + // Required. The name of the version to delete. + // Supported formats: + // + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Version" + } + ]; +} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/webhook.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/webhook.proto new file mode 100644 index 00000000..ce72e92d --- /dev/null +++ b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/webhook.proto @@ -0,0 +1,145 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2; + +import "google/cloud/dialogflow/v2/context.proto"; +import "google/cloud/dialogflow/v2/intent.proto"; +import "google/cloud/dialogflow/v2/session.proto"; +import "google/cloud/dialogflow/v2/session_entity_type.proto"; +import "google/protobuf/struct.proto"; +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "WebhookProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// The request message for a webhook call. +message WebhookRequest { + // The unique identifier of detectIntent request session. + // Can be used to identify end-user inside webhook implementation. + // Format: `projects//agent/sessions/`, or + // `projects//agent/environments//users//sessions/`. + string session = 4; + + // The unique identifier of the response. Contains the same value as + // `[Streaming]DetectIntentResponse.response_id`. + string response_id = 1; + + // The result of the conversational query or event processing. Contains the + // same value as `[Streaming]DetectIntentResponse.query_result`. + QueryResult query_result = 2; + + // Optional. The contents of the original request that was passed to + // `[Streaming]DetectIntent` call. + OriginalDetectIntentRequest original_detect_intent_request = 3; +} + +// The response message for a webhook call. +// +// This response is validated by the Dialogflow server. If validation fails, +// an error will be returned in the [QueryResult.diagnostic_info][google.cloud.dialogflow.v2.QueryResult.diagnostic_info] field. +// Setting JSON fields to an empty value with the wrong type is a common error. +// To avoid this error: +// +// - Use `""` for empty strings +// - Use `{}` or `null` for empty objects +// - Use `[]` or `null` for empty arrays +// +// For more information, see the +// [Protocol Buffers Language +// Guide](https://developers.google.com/protocol-buffers/docs/proto3#json). +message WebhookResponse { + // Optional. The text response message intended for the end-user. + // It is recommended to use `fulfillment_messages.text.text[0]` instead. + // When provided, Dialogflow uses this field to populate + // [QueryResult.fulfillment_text][google.cloud.dialogflow.v2.QueryResult.fulfillment_text] sent to the integration or API caller. + string fulfillment_text = 1; + + // Optional. The rich response messages intended for the end-user. + // When provided, Dialogflow uses this field to populate + // [QueryResult.fulfillment_messages][google.cloud.dialogflow.v2.QueryResult.fulfillment_messages] sent to the integration or API caller. + repeated Intent.Message fulfillment_messages = 2; + + // Optional. A custom field used to identify the webhook source. + // Arbitrary strings are supported. + // When provided, Dialogflow uses this field to populate + // [QueryResult.webhook_source][google.cloud.dialogflow.v2.QueryResult.webhook_source] sent to the integration or API caller. + string source = 3; + + // Optional. This field can be used to pass custom data from your webhook to the + // integration or API caller. Arbitrary JSON objects are supported. + // When provided, Dialogflow uses this field to populate + // [QueryResult.webhook_payload][google.cloud.dialogflow.v2.QueryResult.webhook_payload] sent to the integration or API caller. + // This field is also used by the + // [Google Assistant + // integration](https://cloud.google.com/dialogflow/docs/integrations/aog) + // for rich response messages. + // See the format definition at [Google Assistant Dialogflow webhook + // format](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json) + google.protobuf.Struct payload = 4; + + // Optional. The collection of output contexts that will overwrite currently + // active contexts for the session and reset their lifespans. + // When provided, Dialogflow uses this field to populate + // [QueryResult.output_contexts][google.cloud.dialogflow.v2.QueryResult.output_contexts] sent to the integration or API caller. + repeated Context output_contexts = 5; + + // Optional. Invokes the supplied events. + // When this field is set, Dialogflow ignores the `fulfillment_text`, + // `fulfillment_messages`, and `payload` fields. + EventInput followup_event_input = 6; + + // Optional. Additional session entity types to replace or extend developer + // entity types with. The entity synonyms apply to all languages and persist + // for the session. Setting this data from a webhook overwrites + // the session entity types that have been set using `detectIntent`, + // `streamingDetectIntent` or [SessionEntityType][google.cloud.dialogflow.v2.SessionEntityType] management methods. + repeated SessionEntityType session_entity_types = 10; +} + +// Represents the contents of the original request that was passed to +// the `[Streaming]DetectIntent` call. +message OriginalDetectIntentRequest { + // The source of this request, e.g., `google`, `facebook`, `slack`. It is set + // by Dialogflow-owned servers. + string source = 1; + + // Optional. The version of the protocol used for this request. + // This field is AoG-specific. + string version = 2; + + // Optional. This field is set to the value of the `QueryParameters.payload` + // field passed in the request. Some integrations that query a Dialogflow + // agent may provide additional information in the payload. + // + // In particular, for the Dialogflow Phone Gateway integration, this field has + // the form: + //
{
+  //  "telephony": {
+  //    "caller_id": "+18558363987"
+  //  }
+  // }
+ // Note: The caller ID field (`caller_id`) will be redacted for Trial + // Edition agents and populated with the caller ID in [E.164 + // format](https://en.wikipedia.org/wiki/E.164) for Essentials Edition agents. + google.protobuf.Struct payload = 3; +} diff --git a/owl-bot-staging/v2/src/index.ts b/owl-bot-staging/v2/src/index.ts new file mode 100644 index 00000000..dd1e9ab7 --- /dev/null +++ b/owl-bot-staging/v2/src/index.ts @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v2 from './v2'; +const AgentsClient = v2.AgentsClient; +type AgentsClient = v2.AgentsClient; +const AnswerRecordsClient = v2.AnswerRecordsClient; +type AnswerRecordsClient = v2.AnswerRecordsClient; +const ContextsClient = v2.ContextsClient; +type ContextsClient = v2.ContextsClient; +const ConversationProfilesClient = v2.ConversationProfilesClient; +type ConversationProfilesClient = v2.ConversationProfilesClient; +const ConversationsClient = v2.ConversationsClient; +type ConversationsClient = v2.ConversationsClient; +const DocumentsClient = v2.DocumentsClient; +type DocumentsClient = v2.DocumentsClient; +const EntityTypesClient = v2.EntityTypesClient; +type EntityTypesClient = v2.EntityTypesClient; +const EnvironmentsClient = v2.EnvironmentsClient; +type EnvironmentsClient = v2.EnvironmentsClient; +const FulfillmentsClient = v2.FulfillmentsClient; +type FulfillmentsClient = v2.FulfillmentsClient; +const IntentsClient = v2.IntentsClient; +type IntentsClient = v2.IntentsClient; +const KnowledgeBasesClient = v2.KnowledgeBasesClient; +type KnowledgeBasesClient = v2.KnowledgeBasesClient; +const ParticipantsClient = v2.ParticipantsClient; +type ParticipantsClient = v2.ParticipantsClient; +const SessionEntityTypesClient = v2.SessionEntityTypesClient; +type SessionEntityTypesClient = v2.SessionEntityTypesClient; +const SessionsClient = v2.SessionsClient; +type SessionsClient = v2.SessionsClient; +const VersionsClient = v2.VersionsClient; +type VersionsClient = v2.VersionsClient; +export {v2, AgentsClient, AnswerRecordsClient, ContextsClient, ConversationProfilesClient, ConversationsClient, DocumentsClient, EntityTypesClient, EnvironmentsClient, FulfillmentsClient, IntentsClient, KnowledgeBasesClient, ParticipantsClient, SessionEntityTypesClient, SessionsClient, VersionsClient}; +export default {v2, AgentsClient, AnswerRecordsClient, ContextsClient, ConversationProfilesClient, ConversationsClient, DocumentsClient, EntityTypesClient, EnvironmentsClient, FulfillmentsClient, IntentsClient, KnowledgeBasesClient, ParticipantsClient, SessionEntityTypesClient, SessionsClient, VersionsClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v2/src/v2/agents_client.ts b/owl-bot-staging/v2/src/v2/agents_client.ts new file mode 100644 index 00000000..b186b1e8 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/agents_client.ts @@ -0,0 +1,3085 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/agents_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './agents_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.Agent|Agents}. + * @class + * @memberof v2 + */ +export class AgentsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + agentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AgentsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof AgentsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + searchAgents: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'agents') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + + this.operationsClient = this._gaxModule.lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }).operationsClient(opts); + const trainAgentResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const trainAgentMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + const exportAgentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.ExportAgentResponse') as gax.protobuf.Type; + const exportAgentMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + const importAgentResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const importAgentMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + const restoreAgentResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const restoreAgentMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + + this.descriptors.longrunning = { + trainAgent: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + trainAgentResponse.decode.bind(trainAgentResponse), + trainAgentMetadata.decode.bind(trainAgentMetadata)), + exportAgent: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + exportAgentResponse.decode.bind(exportAgentResponse), + exportAgentMetadata.decode.bind(exportAgentMetadata)), + importAgent: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importAgentResponse.decode.bind(importAgentResponse), + importAgentMetadata.decode.bind(importAgentMetadata)), + restoreAgent: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + restoreAgentResponse.decode.bind(restoreAgentResponse), + restoreAgentMetadata.decode.bind(restoreAgentMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.Agents', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.agentsStub) { + return this.agentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.Agents. + this.agentsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.Agents') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.Agents, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const agentsStubMethods = + ['getAgent', 'setAgent', 'deleteAgent', 'searchAgents', 'trainAgent', 'exportAgent', 'importAgent', 'restoreAgent', 'getValidationResult']; + for (const methodName of agentsStubMethods) { + const callPromise = this.agentsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.agentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getAgent( + request?: protos.google.cloud.dialogflow.v2.IGetAgentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.IGetAgentRequest|undefined, {}|undefined + ]>; + getAgent( + request: protos.google.cloud.dialogflow.v2.IGetAgentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.IGetAgentRequest|null|undefined, + {}|null|undefined>): void; + getAgent( + request: protos.google.cloud.dialogflow.v2.IGetAgentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.IGetAgentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to fetch is associated with. + * Format: `projects/`. + * @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. + * The first element of the array is an object representing [Agent]{@link google.cloud.dialogflow.v2.Agent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getAgent(request); + */ + getAgent( + request?: protos.google.cloud.dialogflow.v2.IGetAgentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.IGetAgentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.IGetAgentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.IGetAgentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.getAgent(request, options, callback); + } + setAgent( + request?: protos.google.cloud.dialogflow.v2.ISetAgentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.ISetAgentRequest|undefined, {}|undefined + ]>; + setAgent( + request: protos.google.cloud.dialogflow.v2.ISetAgentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.ISetAgentRequest|null|undefined, + {}|null|undefined>): void; + setAgent( + request: protos.google.cloud.dialogflow.v2.ISetAgentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.ISetAgentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates/updates the specified agent. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.Agent} request.agent + * Required. The agent to update. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @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. + * The first element of the array is an object representing [Agent]{@link google.cloud.dialogflow.v2.Agent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.setAgent(request); + */ + setAgent( + request?: protos.google.cloud.dialogflow.v2.ISetAgentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.ISetAgentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.ISetAgentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.ISetAgentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'agent.parent': request.agent!.parent || '', + }); + this.initialize(); + return this.innerApiCalls.setAgent(request, options, callback); + } + deleteAgent( + request?: protos.google.cloud.dialogflow.v2.IDeleteAgentRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteAgentRequest|undefined, {}|undefined + ]>; + deleteAgent( + request: protos.google.cloud.dialogflow.v2.IDeleteAgentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteAgentRequest|null|undefined, + {}|null|undefined>): void; + deleteAgent( + request: protos.google.cloud.dialogflow.v2.IDeleteAgentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteAgentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to delete is associated with. + * Format: `projects/`. + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteAgent(request); + */ + deleteAgent( + request?: protos.google.cloud.dialogflow.v2.IDeleteAgentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteAgentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteAgentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteAgentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.deleteAgent(request, options, callback); + } + getValidationResult( + request?: protos.google.cloud.dialogflow.v2.IGetValidationResultRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IValidationResult, + protos.google.cloud.dialogflow.v2.IGetValidationResultRequest|undefined, {}|undefined + ]>; + getValidationResult( + request: protos.google.cloud.dialogflow.v2.IGetValidationResultRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IValidationResult, + protos.google.cloud.dialogflow.v2.IGetValidationResultRequest|null|undefined, + {}|null|undefined>): void; + getValidationResult( + request: protos.google.cloud.dialogflow.v2.IGetValidationResultRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IValidationResult, + protos.google.cloud.dialogflow.v2.IGetValidationResultRequest|null|undefined, + {}|null|undefined>): void; +/** + * Gets agent validation result. Agent validation is performed during + * training time and is updated automatically when training is completed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent is associated with. + * Format: `projects/`. + * @param {string} [request.languageCode] + * Optional. The language for which you want a validation result. If not + * specified, the agent's default language is used. [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. Note: languages must be enabled in the agent before they can + * be used. + * @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. + * The first element of the array is an object representing [ValidationResult]{@link google.cloud.dialogflow.v2.ValidationResult}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getValidationResult(request); + */ + getValidationResult( + request?: protos.google.cloud.dialogflow.v2.IGetValidationResultRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IValidationResult, + protos.google.cloud.dialogflow.v2.IGetValidationResultRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IValidationResult, + protos.google.cloud.dialogflow.v2.IGetValidationResultRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IValidationResult, + protos.google.cloud.dialogflow.v2.IGetValidationResultRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.getValidationResult(request, options, callback); + } + + trainAgent( + request?: protos.google.cloud.dialogflow.v2.ITrainAgentRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + trainAgent( + request: protos.google.cloud.dialogflow.v2.ITrainAgentRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + trainAgent( + request: protos.google.cloud.dialogflow.v2.ITrainAgentRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Trains the specified agent. + * + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to train is associated with. + * Format: `projects/`. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.trainAgent(request); + * const [response] = await operation.promise(); + */ + trainAgent( + request?: protos.google.cloud.dialogflow.v2.ITrainAgentRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.trainAgent(request, options, callback); + } +/** + * Check the status of the long running operation returned by `trainAgent()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkTrainAgentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkTrainAgentProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.trainAgent, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + exportAgent( + request?: protos.google.cloud.dialogflow.v2.IExportAgentRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + exportAgent( + request: protos.google.cloud.dialogflow.v2.IExportAgentRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + exportAgent( + request: protos.google.cloud.dialogflow.v2.IExportAgentRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Exports the specified agent to a ZIP file. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to export is associated with. + * Format: `projects/`. + * @param {string} request.agentUri + * Required. The [Google Cloud Storage](https://cloud.google.com/storage/docs/) + * URI to export the agent to. + * The format of this URI must be `gs:///`. + * If left unspecified, the serialized agent is returned inline. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.exportAgent(request); + * const [response] = await operation.promise(); + */ + exportAgent( + request?: protos.google.cloud.dialogflow.v2.IExportAgentRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.exportAgent(request, options, callback); + } +/** + * Check the status of the long running operation returned by `exportAgent()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkExportAgentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkExportAgentProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.exportAgent, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + importAgent( + request?: protos.google.cloud.dialogflow.v2.IImportAgentRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + importAgent( + request: protos.google.cloud.dialogflow.v2.IImportAgentRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + importAgent( + request: protos.google.cloud.dialogflow.v2.IImportAgentRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Imports the specified agent from a ZIP file. + * + * Uploads new intents and entity types without deleting the existing ones. + * Intents and entity types with the same name are replaced with the new + * versions from {@link google.cloud.dialogflow.v2.ImportAgentRequest|ImportAgentRequest}. After the import, the imported draft + * agent will be trained automatically (unless disabled in agent settings). + * However, once the import is done, training may not be completed yet. Please + * call {@link google.cloud.dialogflow.v2.Agents.TrainAgent|TrainAgent} and wait for the operation it returns in order to train + * explicitly. + * + * An operation which tracks when importing is complete. It only tracks + * when the draft agent is updated not when it is done training. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to import is associated with. + * Format: `projects/`. + * @param {string} request.agentUri + * The URI to a Google Cloud Storage file containing the agent to import. + * Note: The URI must start with "gs://". + * @param {Buffer} request.agentContent + * Zip compressed raw byte content for agent. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.importAgent(request); + * const [response] = await operation.promise(); + */ + importAgent( + request?: protos.google.cloud.dialogflow.v2.IImportAgentRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.importAgent(request, options, callback); + } +/** + * Check the status of the long running operation returned by `importAgent()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkImportAgentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkImportAgentProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.importAgent, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + restoreAgent( + request?: protos.google.cloud.dialogflow.v2.IRestoreAgentRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + restoreAgent( + request: protos.google.cloud.dialogflow.v2.IRestoreAgentRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreAgent( + request: protos.google.cloud.dialogflow.v2.IRestoreAgentRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Restores the specified agent from a ZIP file. + * + * Replaces the current agent version with a new one. All the intents and + * entity types in the older version are deleted. After the restore, the + * restored draft agent will be trained automatically (unless disabled in + * agent settings). However, once the restore is done, training may not be + * completed yet. Please call {@link google.cloud.dialogflow.v2.Agents.TrainAgent|TrainAgent} and wait for the operation it + * returns in order to train explicitly. + * + * An operation which tracks when restoring is complete. It only tracks + * when the draft agent is updated not when it is done training. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to restore is associated with. + * Format: `projects/`. + * @param {string} request.agentUri + * The URI to a Google Cloud Storage file containing the agent to restore. + * Note: The URI must start with "gs://". + * @param {Buffer} request.agentContent + * Zip compressed raw byte content for agent. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.restoreAgent(request); + * const [response] = await operation.promise(); + */ + restoreAgent( + request?: protos.google.cloud.dialogflow.v2.IRestoreAgentRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.restoreAgent(request, options, callback); + } +/** + * Check the status of the long running operation returned by `restoreAgent()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkRestoreAgentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkRestoreAgentProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.restoreAgent, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + searchAgents( + request?: protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IAgent[], + protos.google.cloud.dialogflow.v2.ISearchAgentsRequest|null, + protos.google.cloud.dialogflow.v2.ISearchAgentsResponse + ]>; + searchAgents( + request: protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, + protos.google.cloud.dialogflow.v2.ISearchAgentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IAgent>): void; + searchAgents( + request: protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, + protos.google.cloud.dialogflow.v2.ISearchAgentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IAgent>): void; +/** + * Returns the list of agents. + * + * Since there is at most one conversational agent per project, this method is + * useful primarily for listing all agents across projects the caller has + * access to. One can achieve that with a wildcard project collection id "-". + * Refer to [List + * Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list agents from. + * Format: `projects/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [Agent]{@link google.cloud.dialogflow.v2.Agent}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `searchAgentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + searchAgents( + request?: protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, + protos.google.cloud.dialogflow.v2.ISearchAgentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IAgent>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, + protos.google.cloud.dialogflow.v2.ISearchAgentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IAgent>): + Promise<[ + protos.google.cloud.dialogflow.v2.IAgent[], + protos.google.cloud.dialogflow.v2.ISearchAgentsRequest|null, + protos.google.cloud.dialogflow.v2.ISearchAgentsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.searchAgents(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list agents from. + * Format: `projects/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Agent]{@link google.cloud.dialogflow.v2.Agent} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `searchAgentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + searchAgentsStream( + request?: protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.searchAgents.createStream( + this.innerApiCalls.searchAgents as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `searchAgents`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list agents from. + * Format: `projects/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Agent]{@link google.cloud.dialogflow.v2.Agent}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.searchAgentsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + searchAgentsAsync( + request?: protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.searchAgents.asyncIterate( + this.innerApiCalls['searchAgents'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.agentsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/agents_client_config.json b/owl-bot-staging/v2/src/v2/agents_client_config.json new file mode 100644 index 00000000..93d6e00d --- /dev/null +++ b/owl-bot-staging/v2/src/v2/agents_client_config.json @@ -0,0 +1,74 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.Agents": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "GetAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SetAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SearchAgents": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "TrainAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ExportAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ImportAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "RestoreAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetValidationResult": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/agents_proto_list.json b/owl-bot-staging/v2/src/v2/agents_proto_list.json new file mode 100644 index 00000000..d2ecb25e --- /dev/null +++ b/owl-bot-staging/v2/src/v2/agents_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/owl-bot-staging/v2/src/v2/answer_records_client.ts b/owl-bot-staging/v2/src/v2/answer_records_client.ts new file mode 100644 index 00000000..091de818 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/answer_records_client.ts @@ -0,0 +1,2408 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/answer_records_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './answer_records_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.AnswerRecord|AnswerRecords}. + * @class + * @memberof v2 + */ +export class AnswerRecordsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + answerRecordsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AnswerRecordsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof AnswerRecordsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listAnswerRecords: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'answerRecords') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.AnswerRecords', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.answerRecordsStub) { + return this.answerRecordsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.AnswerRecords. + this.answerRecordsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.AnswerRecords') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.AnswerRecords, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const answerRecordsStubMethods = + ['listAnswerRecords', 'updateAnswerRecord']; + for (const methodName of answerRecordsStubMethods) { + const callPromise = this.answerRecordsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.answerRecordsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + updateAnswerRecord( + request?: protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IAnswerRecord, + protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest|undefined, {}|undefined + ]>; + updateAnswerRecord( + request: protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IAnswerRecord, + protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest|null|undefined, + {}|null|undefined>): void; + updateAnswerRecord( + request: protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IAnswerRecord, + protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified answer record. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.AnswerRecord} request.answerRecord + * Required. Answer record to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields get updated. + * @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. + * The first element of the array is an object representing [AnswerRecord]{@link google.cloud.dialogflow.v2.AnswerRecord}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateAnswerRecord(request); + */ + updateAnswerRecord( + request?: protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IAnswerRecord, + protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IAnswerRecord, + protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IAnswerRecord, + protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'answer_record.name': request.answerRecord!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateAnswerRecord(request, options, callback); + } + + listAnswerRecords( + request?: protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IAnswerRecord[], + protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest|null, + protos.google.cloud.dialogflow.v2.IListAnswerRecordsResponse + ]>; + listAnswerRecords( + request: protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, + protos.google.cloud.dialogflow.v2.IListAnswerRecordsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IAnswerRecord>): void; + listAnswerRecords( + request: protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, + protos.google.cloud.dialogflow.v2.IListAnswerRecordsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IAnswerRecord>): void; +/** + * Returns the list of all answer records in the specified project in reverse + * chronological order. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list all answer records for in reverse + * chronological order. Format: `projects//locations/`. + * @param {string} request.filter + * Required. Filters to restrict results to specific answer records. + * Filter on answer record type. Currently predicates on `type` is supported, + * valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} [request.pageSize] + * Optional. The maximum number of records to return in a single page. + * The server may return fewer records than this. If unspecified, we use 10. + * The maximum is 100. + * @param {string} [request.pageToken] + * Optional. The + * {@link google.cloud.dialogflow.v2.ListAnswerRecordsResponse.next_page_token|ListAnswerRecordsResponse.next_page_token} + * value returned from a previous list request used to continue listing on + * the next page. + * @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. + * The first element of the array is Array of [AnswerRecord]{@link google.cloud.dialogflow.v2.AnswerRecord}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listAnswerRecordsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAnswerRecords( + request?: protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, + protos.google.cloud.dialogflow.v2.IListAnswerRecordsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IAnswerRecord>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, + protos.google.cloud.dialogflow.v2.IListAnswerRecordsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IAnswerRecord>): + Promise<[ + protos.google.cloud.dialogflow.v2.IAnswerRecord[], + protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest|null, + protos.google.cloud.dialogflow.v2.IListAnswerRecordsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listAnswerRecords(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list all answer records for in reverse + * chronological order. Format: `projects//locations/`. + * @param {string} request.filter + * Required. Filters to restrict results to specific answer records. + * Filter on answer record type. Currently predicates on `type` is supported, + * valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} [request.pageSize] + * Optional. The maximum number of records to return in a single page. + * The server may return fewer records than this. If unspecified, we use 10. + * The maximum is 100. + * @param {string} [request.pageToken] + * Optional. The + * {@link google.cloud.dialogflow.v2.ListAnswerRecordsResponse.next_page_token|ListAnswerRecordsResponse.next_page_token} + * value returned from a previous list request used to continue listing on + * the next page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [AnswerRecord]{@link google.cloud.dialogflow.v2.AnswerRecord} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listAnswerRecordsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAnswerRecordsStream( + request?: protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listAnswerRecords.createStream( + this.innerApiCalls.listAnswerRecords as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAnswerRecords`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list all answer records for in reverse + * chronological order. Format: `projects//locations/`. + * @param {string} request.filter + * Required. Filters to restrict results to specific answer records. + * Filter on answer record type. Currently predicates on `type` is supported, + * valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} [request.pageSize] + * Optional. The maximum number of records to return in a single page. + * The server may return fewer records than this. If unspecified, we use 10. + * The maximum is 100. + * @param {string} [request.pageToken] + * Optional. The + * {@link google.cloud.dialogflow.v2.ListAnswerRecordsResponse.next_page_token|ListAnswerRecordsResponse.next_page_token} + * value returned from a previous list request used to continue listing on + * the next page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [AnswerRecord]{@link google.cloud.dialogflow.v2.AnswerRecord}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listAnswerRecordsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listAnswerRecordsAsync( + request?: protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listAnswerRecords.asyncIterate( + this.innerApiCalls['listAnswerRecords'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.answerRecordsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/answer_records_client_config.json b/owl-bot-staging/v2/src/v2/answer_records_client_config.json new file mode 100644 index 00000000..cc29e1ea --- /dev/null +++ b/owl-bot-staging/v2/src/v2/answer_records_client_config.json @@ -0,0 +1,39 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.AnswerRecords": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListAnswerRecords": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateAnswerRecord": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/answer_records_proto_list.json b/owl-bot-staging/v2/src/v2/answer_records_proto_list.json new file mode 100644 index 00000000..d2ecb25e --- /dev/null +++ b/owl-bot-staging/v2/src/v2/answer_records_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/owl-bot-staging/v2/src/v2/contexts_client.ts b/owl-bot-staging/v2/src/v2/contexts_client.ts new file mode 100644 index 00000000..df97d6f0 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/contexts_client.ts @@ -0,0 +1,2730 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/contexts_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './contexts_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.Context|Contexts}. + * @class + * @memberof v2 + */ +export class ContextsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + contextsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ContextsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ContextsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listContexts: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'contexts') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.Contexts', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.contextsStub) { + return this.contextsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.Contexts. + this.contextsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.Contexts') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.Contexts, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const contextsStubMethods = + ['listContexts', 'getContext', 'createContext', 'updateContext', 'deleteContext', 'deleteAllContexts']; + for (const methodName of contextsStubMethods) { + const callPromise = this.contextsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.contextsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getContext( + request?: protos.google.cloud.dialogflow.v2.IGetContextRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.IGetContextRequest|undefined, {}|undefined + ]>; + getContext( + request: protos.google.cloud.dialogflow.v2.IGetContextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.IGetContextRequest|null|undefined, + {}|null|undefined>): void; + getContext( + request: protos.google.cloud.dialogflow.v2.IGetContextRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.IGetContextRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified context. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the context. Format: + * `projects//agent/sessions//contexts/` + * or `projects//agent/environments//users//sessions//contexts/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @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. + * The first element of the array is an object representing [Context]{@link google.cloud.dialogflow.v2.Context}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getContext(request); + */ + getContext( + request?: protos.google.cloud.dialogflow.v2.IGetContextRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.IGetContextRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.IGetContextRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.IGetContextRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getContext(request, options, callback); + } + createContext( + request?: protos.google.cloud.dialogflow.v2.ICreateContextRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.ICreateContextRequest|undefined, {}|undefined + ]>; + createContext( + request: protos.google.cloud.dialogflow.v2.ICreateContextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.ICreateContextRequest|null|undefined, + {}|null|undefined>): void; + createContext( + request: protos.google.cloud.dialogflow.v2.ICreateContextRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.ICreateContextRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a context. + * + * If the specified context already exists, overrides the context. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to create a context for. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @param {google.cloud.dialogflow.v2.Context} request.context + * Required. The context to create. + * @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. + * The first element of the array is an object representing [Context]{@link google.cloud.dialogflow.v2.Context}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createContext(request); + */ + createContext( + request?: protos.google.cloud.dialogflow.v2.ICreateContextRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.ICreateContextRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.ICreateContextRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.ICreateContextRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createContext(request, options, callback); + } + updateContext( + request?: protos.google.cloud.dialogflow.v2.IUpdateContextRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.IUpdateContextRequest|undefined, {}|undefined + ]>; + updateContext( + request: protos.google.cloud.dialogflow.v2.IUpdateContextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.IUpdateContextRequest|null|undefined, + {}|null|undefined>): void; + updateContext( + request: protos.google.cloud.dialogflow.v2.IUpdateContextRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.IUpdateContextRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified context. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.Context} request.context + * Required. The context to update. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @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. + * The first element of the array is an object representing [Context]{@link google.cloud.dialogflow.v2.Context}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateContext(request); + */ + updateContext( + request?: protos.google.cloud.dialogflow.v2.IUpdateContextRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.IUpdateContextRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.IUpdateContextRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.IUpdateContextRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'context.name': request.context!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateContext(request, options, callback); + } + deleteContext( + request?: protos.google.cloud.dialogflow.v2.IDeleteContextRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteContextRequest|undefined, {}|undefined + ]>; + deleteContext( + request: protos.google.cloud.dialogflow.v2.IDeleteContextRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteContextRequest|null|undefined, + {}|null|undefined>): void; + deleteContext( + request: protos.google.cloud.dialogflow.v2.IDeleteContextRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteContextRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified context. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the context to delete. Format: + * `projects//agent/sessions//contexts/` + * or `projects//agent/environments//users//sessions//contexts/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteContext(request); + */ + deleteContext( + request?: protos.google.cloud.dialogflow.v2.IDeleteContextRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteContextRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteContextRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteContextRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteContext(request, options, callback); + } + deleteAllContexts( + request?: protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest|undefined, {}|undefined + ]>; + deleteAllContexts( + request: protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest|null|undefined, + {}|null|undefined>): void; + deleteAllContexts( + request: protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes all active contexts in the specified session. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the session to delete all contexts from. Format: + * `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. + * If `Environment ID` is not specified we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteAllContexts(request); + */ + deleteAllContexts( + request?: protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.deleteAllContexts(request, options, callback); + } + + listContexts( + request?: protos.google.cloud.dialogflow.v2.IListContextsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IContext[], + protos.google.cloud.dialogflow.v2.IListContextsRequest|null, + protos.google.cloud.dialogflow.v2.IListContextsResponse + ]>; + listContexts( + request: protos.google.cloud.dialogflow.v2.IListContextsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListContextsRequest, + protos.google.cloud.dialogflow.v2.IListContextsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IContext>): void; + listContexts( + request: protos.google.cloud.dialogflow.v2.IListContextsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListContextsRequest, + protos.google.cloud.dialogflow.v2.IListContextsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IContext>): void; +/** + * Returns the list of all contexts in the specified session. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to list all contexts from. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [Context]{@link google.cloud.dialogflow.v2.Context}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listContextsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listContexts( + request?: protos.google.cloud.dialogflow.v2.IListContextsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2.IListContextsRequest, + protos.google.cloud.dialogflow.v2.IListContextsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IContext>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListContextsRequest, + protos.google.cloud.dialogflow.v2.IListContextsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IContext>): + Promise<[ + protos.google.cloud.dialogflow.v2.IContext[], + protos.google.cloud.dialogflow.v2.IListContextsRequest|null, + protos.google.cloud.dialogflow.v2.IListContextsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listContexts(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to list all contexts from. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Context]{@link google.cloud.dialogflow.v2.Context} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listContextsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listContextsStream( + request?: protos.google.cloud.dialogflow.v2.IListContextsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listContexts.createStream( + this.innerApiCalls.listContexts as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listContexts`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to list all contexts from. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Context]{@link google.cloud.dialogflow.v2.Context}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listContextsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listContextsAsync( + request?: protos.google.cloud.dialogflow.v2.IListContextsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listContexts.asyncIterate( + this.innerApiCalls['listContexts'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSession resource name string. + * + * @param {string} project + * @param {string} session + * @returns {string} Resource name string. + */ + projectAgentSessionPath(project:string,session:string) { + return this.pathTemplates.projectAgentSessionPathTemplate.render({ + project: project, + session: session, + }); + } + + /** + * Parse the project from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).project; + } + + /** + * Parse the session from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).session; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.contextsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/contexts_client_config.json b/owl-bot-staging/v2/src/v2/contexts_client_config.json new file mode 100644 index 00000000..c44e6aaa --- /dev/null +++ b/owl-bot-staging/v2/src/v2/contexts_client_config.json @@ -0,0 +1,59 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.Contexts": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListContexts": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetContext": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateContext": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateContext": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteContext": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteAllContexts": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/contexts_proto_list.json b/owl-bot-staging/v2/src/v2/contexts_proto_list.json new file mode 100644 index 00000000..d2ecb25e --- /dev/null +++ b/owl-bot-staging/v2/src/v2/contexts_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/owl-bot-staging/v2/src/v2/conversation_profiles_client.ts b/owl-bot-staging/v2/src/v2/conversation_profiles_client.ts new file mode 100644 index 00000000..2d9fa724 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/conversation_profiles_client.ts @@ -0,0 +1,2599 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/conversation_profiles_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './conversation_profiles_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.ConversationProfile|ConversationProfiles}. + * @class + * @memberof v2 + */ +export class ConversationProfilesClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + conversationProfilesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ConversationProfilesClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ConversationProfilesClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listConversationProfiles: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'conversationProfiles') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.ConversationProfiles', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.conversationProfilesStub) { + return this.conversationProfilesStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.ConversationProfiles. + this.conversationProfilesStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.ConversationProfiles') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.ConversationProfiles, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const conversationProfilesStubMethods = + ['listConversationProfiles', 'getConversationProfile', 'createConversationProfile', 'updateConversationProfile', 'deleteConversationProfile']; + for (const methodName of conversationProfilesStubMethods) { + const callPromise = this.conversationProfilesStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.conversationProfilesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getConversationProfile( + request?: protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest|undefined, {}|undefined + ]>; + getConversationProfile( + request: protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest|null|undefined, + {}|null|undefined>): void; + getConversationProfile( + request: protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified conversation profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the conversation profile. + * Format: `projects//locations//conversationProfiles/`. + * @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. + * The first element of the array is an object representing [ConversationProfile]{@link google.cloud.dialogflow.v2.ConversationProfile}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getConversationProfile(request); + */ + getConversationProfile( + request?: protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getConversationProfile(request, options, callback); + } + createConversationProfile( + request?: protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest|undefined, {}|undefined + ]>; + createConversationProfile( + request: protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest|null|undefined, + {}|null|undefined>): void; + createConversationProfile( + request: protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a conversation profile in the specified project. + * + * {@link |ConversationProfile.CreateTime} and {@link |ConversationProfile.UpdateTime} + * aren't populated in the response. You can retrieve them via + * {@link google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile|GetConversationProfile} API. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to create a conversation profile for. + * Format: `projects//locations/`. + * @param {google.cloud.dialogflow.v2.ConversationProfile} request.conversationProfile + * Required. The conversation profile to create. + * @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. + * The first element of the array is an object representing [ConversationProfile]{@link google.cloud.dialogflow.v2.ConversationProfile}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createConversationProfile(request); + */ + createConversationProfile( + request?: protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createConversationProfile(request, options, callback); + } + updateConversationProfile( + request?: protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest|undefined, {}|undefined + ]>; + updateConversationProfile( + request: protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest|null|undefined, + {}|null|undefined>): void; + updateConversationProfile( + request: protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified conversation profile. + * + * {@link |ConversationProfile.CreateTime} and {@link |ConversationProfile.UpdateTime} + * aren't populated in the response. You can retrieve them via + * {@link google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile|GetConversationProfile} API. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.ConversationProfile} request.conversationProfile + * Required. The conversation profile to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields to update. + * @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. + * The first element of the array is an object representing [ConversationProfile]{@link google.cloud.dialogflow.v2.ConversationProfile}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateConversationProfile(request); + */ + updateConversationProfile( + request?: protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'conversation_profile.name': request.conversationProfile!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateConversationProfile(request, options, callback); + } + deleteConversationProfile( + request?: protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest|undefined, {}|undefined + ]>; + deleteConversationProfile( + request: protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest|null|undefined, + {}|null|undefined>): void; + deleteConversationProfile( + request: protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified conversation profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the conversation profile to delete. + * Format: `projects//locations//conversationProfiles/`. + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteConversationProfile(request); + */ + deleteConversationProfile( + request?: protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteConversationProfile(request, options, callback); + } + + listConversationProfiles( + request?: protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversationProfile[], + protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest|null, + protos.google.cloud.dialogflow.v2.IListConversationProfilesResponse + ]>; + listConversationProfiles( + request: protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, + protos.google.cloud.dialogflow.v2.IListConversationProfilesResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IConversationProfile>): void; + listConversationProfiles( + request: protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, + protos.google.cloud.dialogflow.v2.IListConversationProfilesResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IConversationProfile>): void; +/** + * Returns the list of all conversation profiles in the specified project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list all conversation profiles from. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [ConversationProfile]{@link google.cloud.dialogflow.v2.ConversationProfile}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listConversationProfilesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listConversationProfiles( + request?: protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, + protos.google.cloud.dialogflow.v2.IListConversationProfilesResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IConversationProfile>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, + protos.google.cloud.dialogflow.v2.IListConversationProfilesResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IConversationProfile>): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversationProfile[], + protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest|null, + protos.google.cloud.dialogflow.v2.IListConversationProfilesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listConversationProfiles(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list all conversation profiles from. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ConversationProfile]{@link google.cloud.dialogflow.v2.ConversationProfile} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listConversationProfilesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listConversationProfilesStream( + request?: protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listConversationProfiles.createStream( + this.innerApiCalls.listConversationProfiles as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listConversationProfiles`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list all conversation profiles from. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [ConversationProfile]{@link google.cloud.dialogflow.v2.ConversationProfile}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listConversationProfilesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listConversationProfilesAsync( + request?: protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listConversationProfiles.asyncIterate( + this.innerApiCalls['listConversationProfiles'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.conversationProfilesStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/conversation_profiles_client_config.json b/owl-bot-staging/v2/src/v2/conversation_profiles_client_config.json new file mode 100644 index 00000000..10c64bdc --- /dev/null +++ b/owl-bot-staging/v2/src/v2/conversation_profiles_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.ConversationProfiles": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListConversationProfiles": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetConversationProfile": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateConversationProfile": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateConversationProfile": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteConversationProfile": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/conversation_profiles_proto_list.json b/owl-bot-staging/v2/src/v2/conversation_profiles_proto_list.json new file mode 100644 index 00000000..d2ecb25e --- /dev/null +++ b/owl-bot-staging/v2/src/v2/conversation_profiles_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/owl-bot-staging/v2/src/v2/conversations_client.ts b/owl-bot-staging/v2/src/v2/conversations_client.ts new file mode 100644 index 00000000..91aee8e0 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/conversations_client.ts @@ -0,0 +1,2818 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/conversations_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './conversations_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.Conversation|Conversations}. + * @class + * @memberof v2 + */ +export class ConversationsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + conversationsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ConversationsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ConversationsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listConversations: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'conversations'), + listMessages: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'messages') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.Conversations', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.conversationsStub) { + return this.conversationsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.Conversations. + this.conversationsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.Conversations') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.Conversations, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const conversationsStubMethods = + ['createConversation', 'listConversations', 'getConversation', 'completeConversation', 'listMessages']; + for (const methodName of conversationsStubMethods) { + const callPromise = this.conversationsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.conversationsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createConversation( + request?: protos.google.cloud.dialogflow.v2.ICreateConversationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.ICreateConversationRequest|undefined, {}|undefined + ]>; + createConversation( + request: protos.google.cloud.dialogflow.v2.ICreateConversationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.ICreateConversationRequest|null|undefined, + {}|null|undefined>): void; + createConversation( + request: protos.google.cloud.dialogflow.v2.ICreateConversationRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.ICreateConversationRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a new conversation. Conversations are auto-completed after 24 + * hours. + * + * Conversation Lifecycle: + * There are two stages during a conversation: Automated Agent Stage and + * Assist Stage. + * + * For Automated Agent Stage, there will be a dialogflow agent responding to + * user queries. + * + * For Assist Stage, there's no dialogflow agent responding to user queries. + * But we will provide suggestions which are generated from conversation. + * + * If {@link google.cloud.dialogflow.v2.Conversation.conversation_profile|Conversation.conversation_profile} is configured for a dialogflow + * agent, conversation will start from `Automated Agent Stage`, otherwise, it + * will start from `Assist Stage`. And during `Automated Agent Stage`, once an + * {@link google.cloud.dialogflow.v2.Intent|Intent} with {@link google.cloud.dialogflow.v2.Intent.live_agent_handoff|Intent.live_agent_handoff} is triggered, conversation + * will transfer to Assist Stage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource identifier of the project creating the conversation. + * Format: `projects//locations/`. + * @param {google.cloud.dialogflow.v2.Conversation} request.conversation + * Required. The conversation to create. + * @param {string} [request.conversationId] + * Optional. Identifier of the conversation. Generally it's auto generated by Google. + * Only set it if you cannot wait for the response to return a + * auto-generated one to you. + * + * The conversation ID must be compliant with the regression fomula + * "{@link a-zA-Z0-9_-|a-zA-Z}*" with the characters length in range of [3,64]. + * If the field is provided, the caller is resposible for + * 1. the uniqueness of the ID, otherwise the request will be rejected. + * 2. the consistency for whether to use custom ID or not under a project to + * better ensure uniqueness. + * @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. + * The first element of the array is an object representing [Conversation]{@link google.cloud.dialogflow.v2.Conversation}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createConversation(request); + */ + createConversation( + request?: protos.google.cloud.dialogflow.v2.ICreateConversationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.ICreateConversationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.ICreateConversationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.ICreateConversationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createConversation(request, options, callback); + } + getConversation( + request?: protos.google.cloud.dialogflow.v2.IGetConversationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.IGetConversationRequest|undefined, {}|undefined + ]>; + getConversation( + request: protos.google.cloud.dialogflow.v2.IGetConversationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.IGetConversationRequest|null|undefined, + {}|null|undefined>): void; + getConversation( + request: protos.google.cloud.dialogflow.v2.IGetConversationRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.IGetConversationRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specific conversation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the conversation. Format: + * `projects//locations//conversations/`. + * @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. + * The first element of the array is an object representing [Conversation]{@link google.cloud.dialogflow.v2.Conversation}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getConversation(request); + */ + getConversation( + request?: protos.google.cloud.dialogflow.v2.IGetConversationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.IGetConversationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.IGetConversationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.IGetConversationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getConversation(request, options, callback); + } + completeConversation( + request?: protos.google.cloud.dialogflow.v2.ICompleteConversationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.ICompleteConversationRequest|undefined, {}|undefined + ]>; + completeConversation( + request: protos.google.cloud.dialogflow.v2.ICompleteConversationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.ICompleteConversationRequest|null|undefined, + {}|null|undefined>): void; + completeConversation( + request: protos.google.cloud.dialogflow.v2.ICompleteConversationRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.ICompleteConversationRequest|null|undefined, + {}|null|undefined>): void; +/** + * Completes the specified conversation. Finished conversations are purged + * from the database after 30 days. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource identifier of the conversation to close. + * Format: `projects//locations//conversations/`. + * @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. + * The first element of the array is an object representing [Conversation]{@link google.cloud.dialogflow.v2.Conversation}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.completeConversation(request); + */ + completeConversation( + request?: protos.google.cloud.dialogflow.v2.ICompleteConversationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.ICompleteConversationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.ICompleteConversationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.ICompleteConversationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.completeConversation(request, options, callback); + } + + listConversations( + request?: protos.google.cloud.dialogflow.v2.IListConversationsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversation[], + protos.google.cloud.dialogflow.v2.IListConversationsRequest|null, + protos.google.cloud.dialogflow.v2.IListConversationsResponse + ]>; + listConversations( + request: protos.google.cloud.dialogflow.v2.IListConversationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationsRequest, + protos.google.cloud.dialogflow.v2.IListConversationsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IConversation>): void; + listConversations( + request: protos.google.cloud.dialogflow.v2.IListConversationsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationsRequest, + protos.google.cloud.dialogflow.v2.IListConversationsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IConversation>): void; +/** + * Returns the list of all conversations in the specified project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project from which to list all conversation. + * Format: `projects//locations/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {string} request.filter + * A filter expression that filters conversations listed in the response. In + * general, the expression must specify the field name, a comparison operator, + * and the value to use for filtering: + *
    + *
  • The value must be a string, a number, or a boolean.
  • + *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + *
  • To filter on multiple expressions, separate the + * expressions with `AND` or `OR` (omitting both implies `AND`).
  • + *
  • For clarity, expressions can be enclosed in parentheses.
  • + *
+ * Only `lifecycle_state` can be filtered on in this way. For example, + * the following expression only returns `COMPLETED` conversations: + * + * `lifecycle_state = "COMPLETED"` + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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. + * The first element of the array is Array of [Conversation]{@link google.cloud.dialogflow.v2.Conversation}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listConversationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listConversations( + request?: protos.google.cloud.dialogflow.v2.IListConversationsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationsRequest, + protos.google.cloud.dialogflow.v2.IListConversationsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IConversation>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationsRequest, + protos.google.cloud.dialogflow.v2.IListConversationsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IConversation>): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversation[], + protos.google.cloud.dialogflow.v2.IListConversationsRequest|null, + protos.google.cloud.dialogflow.v2.IListConversationsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listConversations(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project from which to list all conversation. + * Format: `projects//locations/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {string} request.filter + * A filter expression that filters conversations listed in the response. In + * general, the expression must specify the field name, a comparison operator, + * and the value to use for filtering: + *
    + *
  • The value must be a string, a number, or a boolean.
  • + *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + *
  • To filter on multiple expressions, separate the + * expressions with `AND` or `OR` (omitting both implies `AND`).
  • + *
  • For clarity, expressions can be enclosed in parentheses.
  • + *
+ * Only `lifecycle_state` can be filtered on in this way. For example, + * the following expression only returns `COMPLETED` conversations: + * + * `lifecycle_state = "COMPLETED"` + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Conversation]{@link google.cloud.dialogflow.v2.Conversation} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listConversationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listConversationsStream( + request?: protos.google.cloud.dialogflow.v2.IListConversationsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listConversations.createStream( + this.innerApiCalls.listConversations as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listConversations`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project from which to list all conversation. + * Format: `projects//locations/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {string} request.filter + * A filter expression that filters conversations listed in the response. In + * general, the expression must specify the field name, a comparison operator, + * and the value to use for filtering: + *
    + *
  • The value must be a string, a number, or a boolean.
  • + *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + *
  • To filter on multiple expressions, separate the + * expressions with `AND` or `OR` (omitting both implies `AND`).
  • + *
  • For clarity, expressions can be enclosed in parentheses.
  • + *
+ * Only `lifecycle_state` can be filtered on in this way. For example, + * the following expression only returns `COMPLETED` conversations: + * + * `lifecycle_state = "COMPLETED"` + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Conversation]{@link google.cloud.dialogflow.v2.Conversation}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listConversationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listConversationsAsync( + request?: protos.google.cloud.dialogflow.v2.IListConversationsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listConversations.asyncIterate( + this.innerApiCalls['listConversations'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + listMessages( + request?: protos.google.cloud.dialogflow.v2.IListMessagesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IMessage[], + protos.google.cloud.dialogflow.v2.IListMessagesRequest|null, + protos.google.cloud.dialogflow.v2.IListMessagesResponse + ]>; + listMessages( + request: protos.google.cloud.dialogflow.v2.IListMessagesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListMessagesRequest, + protos.google.cloud.dialogflow.v2.IListMessagesResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IMessage>): void; + listMessages( + request: protos.google.cloud.dialogflow.v2.IListMessagesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListMessagesRequest, + protos.google.cloud.dialogflow.v2.IListMessagesResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IMessage>): void; +/** + * Lists messages that belong to a given conversation. + * `messages` are ordered by `create_time` in descending order. To fetch + * updates without duplication, send request with filter + * `create_time_epoch_microseconds > + * [first item's create_time of previous request]` and empty page_token. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the conversation to list messages for. + * Format: `projects//locations//conversations/` + * @param {string} [request.filter] + * Optional. Filter on message fields. Currently predicates on `create_time` + * and `create_time_epoch_microseconds` are supported. `create_time` only + * support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > 2017-01-15T01:30:15.01Z`. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [Message]{@link google.cloud.dialogflow.v2.Message}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listMessagesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listMessages( + request?: protos.google.cloud.dialogflow.v2.IListMessagesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2.IListMessagesRequest, + protos.google.cloud.dialogflow.v2.IListMessagesResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IMessage>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListMessagesRequest, + protos.google.cloud.dialogflow.v2.IListMessagesResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IMessage>): + Promise<[ + protos.google.cloud.dialogflow.v2.IMessage[], + protos.google.cloud.dialogflow.v2.IListMessagesRequest|null, + protos.google.cloud.dialogflow.v2.IListMessagesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listMessages(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the conversation to list messages for. + * Format: `projects//locations//conversations/` + * @param {string} [request.filter] + * Optional. Filter on message fields. Currently predicates on `create_time` + * and `create_time_epoch_microseconds` are supported. `create_time` only + * support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > 2017-01-15T01:30:15.01Z`. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Message]{@link google.cloud.dialogflow.v2.Message} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listMessagesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listMessagesStream( + request?: protos.google.cloud.dialogflow.v2.IListMessagesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listMessages.createStream( + this.innerApiCalls.listMessages as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listMessages`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the conversation to list messages for. + * Format: `projects//locations//conversations/` + * @param {string} [request.filter] + * Optional. Filter on message fields. Currently predicates on `create_time` + * and `create_time_epoch_microseconds` are supported. `create_time` only + * support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > 2017-01-15T01:30:15.01Z`. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Message]{@link google.cloud.dialogflow.v2.Message}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listMessagesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listMessagesAsync( + request?: protos.google.cloud.dialogflow.v2.IListMessagesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listMessages.asyncIterate( + this.innerApiCalls['listMessages'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.conversationsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/conversations_client_config.json b/owl-bot-staging/v2/src/v2/conversations_client_config.json new file mode 100644 index 00000000..2718600c --- /dev/null +++ b/owl-bot-staging/v2/src/v2/conversations_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.Conversations": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateConversation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListConversations": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetConversation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CompleteConversation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListMessages": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/conversations_proto_list.json b/owl-bot-staging/v2/src/v2/conversations_proto_list.json new file mode 100644 index 00000000..d2ecb25e --- /dev/null +++ b/owl-bot-staging/v2/src/v2/conversations_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/owl-bot-staging/v2/src/v2/documents_client.ts b/owl-bot-staging/v2/src/v2/documents_client.ts new file mode 100644 index 00000000..f7a77bff --- /dev/null +++ b/owl-bot-staging/v2/src/v2/documents_client.ts @@ -0,0 +1,2838 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/documents_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './documents_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for managing knowledge {@link google.cloud.dialogflow.v2.Document|Documents}. + * @class + * @memberof v2 + */ +export class DocumentsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + documentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DocumentsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof DocumentsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listDocuments: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'documents') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + + this.operationsClient = this._gaxModule.lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }).operationsClient(opts); + const createDocumentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.Document') as gax.protobuf.Type; + const createDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.KnowledgeOperationMetadata') as gax.protobuf.Type; + const deleteDocumentResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.KnowledgeOperationMetadata') as gax.protobuf.Type; + const updateDocumentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.Document') as gax.protobuf.Type; + const updateDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.KnowledgeOperationMetadata') as gax.protobuf.Type; + const reloadDocumentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.Document') as gax.protobuf.Type; + const reloadDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.KnowledgeOperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createDocumentResponse.decode.bind(createDocumentResponse), + createDocumentMetadata.decode.bind(createDocumentMetadata)), + deleteDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteDocumentResponse.decode.bind(deleteDocumentResponse), + deleteDocumentMetadata.decode.bind(deleteDocumentMetadata)), + updateDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateDocumentResponse.decode.bind(updateDocumentResponse), + updateDocumentMetadata.decode.bind(updateDocumentMetadata)), + reloadDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + reloadDocumentResponse.decode.bind(reloadDocumentResponse), + reloadDocumentMetadata.decode.bind(reloadDocumentMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.Documents', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.documentsStub) { + return this.documentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.Documents. + this.documentsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.Documents') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.Documents, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const documentsStubMethods = + ['listDocuments', 'getDocument', 'createDocument', 'deleteDocument', 'updateDocument', 'reloadDocument']; + for (const methodName of documentsStubMethods) { + const callPromise = this.documentsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.documentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getDocument( + request?: protos.google.cloud.dialogflow.v2.IGetDocumentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IGetDocumentRequest|undefined, {}|undefined + ]>; + getDocument( + request: protos.google.cloud.dialogflow.v2.IGetDocumentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IGetDocumentRequest|null|undefined, + {}|null|undefined>): void; + getDocument( + request: protos.google.cloud.dialogflow.v2.IGetDocumentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IGetDocumentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified document. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the document to retrieve. + * 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. + * The first element of the array is an object representing [Document]{@link google.cloud.dialogflow.v2.Document}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getDocument(request); + */ + getDocument( + request?: protos.google.cloud.dialogflow.v2.IGetDocumentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IGetDocumentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IGetDocumentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IGetDocumentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getDocument(request, options, callback); + } + + createDocument( + request?: protos.google.cloud.dialogflow.v2.ICreateDocumentRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createDocument( + request: protos.google.cloud.dialogflow.v2.ICreateDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createDocument( + request: protos.google.cloud.dialogflow.v2.ICreateDocumentRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Creates a new document. + * + * Operation + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The knowledge base to create a document for. + * Format: `projects//locations//knowledgeBases/`. + * @param {google.cloud.dialogflow.v2.Document} request.document + * Required. The document to create. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.createDocument(request); + * const [response] = await operation.promise(); + */ + createDocument( + request?: protos.google.cloud.dialogflow.v2.ICreateDocumentRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createDocument(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createDocument()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkCreateDocumentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkCreateDocumentProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createDocument, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + deleteDocument( + request?: protos.google.cloud.dialogflow.v2.IDeleteDocumentRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteDocument( + request: protos.google.cloud.dialogflow.v2.IDeleteDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteDocument( + request: protos.google.cloud.dialogflow.v2.IDeleteDocumentRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified document. + * + * Operation + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the document to delete. + * 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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.deleteDocument(request); + * const [response] = await operation.promise(); + */ + deleteDocument( + request?: protos.google.cloud.dialogflow.v2.IDeleteDocumentRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteDocument(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteDocument()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkDeleteDocumentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkDeleteDocumentProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteDocument, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + updateDocument( + request?: protos.google.cloud.dialogflow.v2.IUpdateDocumentRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateDocument( + request: protos.google.cloud.dialogflow.v2.IUpdateDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateDocument( + request: protos.google.cloud.dialogflow.v2.IUpdateDocumentRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified document. + * + * Operation + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.Document} request.document + * Required. The document to update. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Not specified means `update all`. + * Currently, only `display_name` can be updated, an InvalidArgument will be + * returned for attempting to update other fields. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.updateDocument(request); + * const [response] = await operation.promise(); + */ + updateDocument( + request?: protos.google.cloud.dialogflow.v2.IUpdateDocumentRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'document.name': request.document!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateDocument(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateDocument()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkUpdateDocumentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkUpdateDocumentProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateDocument, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + reloadDocument( + request?: protos.google.cloud.dialogflow.v2.IReloadDocumentRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + reloadDocument( + request: protos.google.cloud.dialogflow.v2.IReloadDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + reloadDocument( + request: protos.google.cloud.dialogflow.v2.IReloadDocumentRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Reloads the specified document from its specified source, content_uri or + * content. The previously loaded content of the document will be deleted. + * Note: Even when the content of the document has not changed, there still + * may be side effects because of internal implementation changes. + * + * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + * only use `projects.knowledgeBases.documents`. + * + * Operation + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the document to reload. + * Format: `projects//locations//knowledgeBases//documents/` + * @param {string} [request.contentUri] + * Optional. The path of gcs source file for reloading document content. For now, + * only gcs uri is supported. + * + * For documents stored in Google Cloud Storage, these URIs must have + * the form `gs:///`. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.reloadDocument(request); + * const [response] = await operation.promise(); + */ + reloadDocument( + request?: protos.google.cloud.dialogflow.v2.IReloadDocumentRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.reloadDocument(request, options, callback); + } +/** + * Check the status of the long running operation returned by `reloadDocument()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkReloadDocumentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkReloadDocumentProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.reloadDocument, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + listDocuments( + request?: protos.google.cloud.dialogflow.v2.IListDocumentsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IDocument[], + protos.google.cloud.dialogflow.v2.IListDocumentsRequest|null, + protos.google.cloud.dialogflow.v2.IListDocumentsResponse + ]>; + listDocuments( + request: protos.google.cloud.dialogflow.v2.IListDocumentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListDocumentsRequest, + protos.google.cloud.dialogflow.v2.IListDocumentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IDocument>): void; + listDocuments( + request: protos.google.cloud.dialogflow.v2.IListDocumentsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListDocumentsRequest, + protos.google.cloud.dialogflow.v2.IListDocumentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IDocument>): void; +/** + * Returns the list of all documents of the knowledge base. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The knowledge base to list all documents for. + * 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. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [Document]{@link google.cloud.dialogflow.v2.Document}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listDocumentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listDocuments( + request?: protos.google.cloud.dialogflow.v2.IListDocumentsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2.IListDocumentsRequest, + protos.google.cloud.dialogflow.v2.IListDocumentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IDocument>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListDocumentsRequest, + protos.google.cloud.dialogflow.v2.IListDocumentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IDocument>): + Promise<[ + protos.google.cloud.dialogflow.v2.IDocument[], + protos.google.cloud.dialogflow.v2.IListDocumentsRequest|null, + protos.google.cloud.dialogflow.v2.IListDocumentsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listDocuments(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The knowledge base to list all documents for. + * 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. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Document]{@link google.cloud.dialogflow.v2.Document} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listDocumentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listDocumentsStream( + request?: protos.google.cloud.dialogflow.v2.IListDocumentsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listDocuments.createStream( + this.innerApiCalls.listDocuments as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listDocuments`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The knowledge base to list all documents for. + * 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. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Document]{@link google.cloud.dialogflow.v2.Document}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listDocumentsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listDocumentsAsync( + request?: protos.google.cloud.dialogflow.v2.IListDocumentsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listDocuments.asyncIterate( + this.innerApiCalls['listDocuments'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.documentsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/documents_client_config.json b/owl-bot-staging/v2/src/v2/documents_client_config.json new file mode 100644 index 00000000..23bb7e66 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/documents_client_config.json @@ -0,0 +1,59 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.Documents": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListDocuments": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ReloadDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/documents_proto_list.json b/owl-bot-staging/v2/src/v2/documents_proto_list.json new file mode 100644 index 00000000..d2ecb25e --- /dev/null +++ b/owl-bot-staging/v2/src/v2/documents_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/owl-bot-staging/v2/src/v2/entity_types_client.ts b/owl-bot-staging/v2/src/v2/entity_types_client.ts new file mode 100644 index 00000000..b5a52a81 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/entity_types_client.ts @@ -0,0 +1,3242 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/entity_types_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './entity_types_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.EntityType|EntityTypes}. + * @class + * @memberof v2 + */ +export class EntityTypesClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + entityTypesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of EntityTypesClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof EntityTypesClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listEntityTypes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'entityTypes') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + + this.operationsClient = this._gaxModule.lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }).operationsClient(opts); + const batchUpdateEntityTypesResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse') as gax.protobuf.Type; + const batchUpdateEntityTypesMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + const batchDeleteEntityTypesResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const batchDeleteEntityTypesMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + const batchCreateEntitiesResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const batchCreateEntitiesMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + const batchUpdateEntitiesResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const batchUpdateEntitiesMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + const batchDeleteEntitiesResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const batchDeleteEntitiesMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + + this.descriptors.longrunning = { + batchUpdateEntityTypes: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchUpdateEntityTypesResponse.decode.bind(batchUpdateEntityTypesResponse), + batchUpdateEntityTypesMetadata.decode.bind(batchUpdateEntityTypesMetadata)), + batchDeleteEntityTypes: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchDeleteEntityTypesResponse.decode.bind(batchDeleteEntityTypesResponse), + batchDeleteEntityTypesMetadata.decode.bind(batchDeleteEntityTypesMetadata)), + batchCreateEntities: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchCreateEntitiesResponse.decode.bind(batchCreateEntitiesResponse), + batchCreateEntitiesMetadata.decode.bind(batchCreateEntitiesMetadata)), + batchUpdateEntities: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchUpdateEntitiesResponse.decode.bind(batchUpdateEntitiesResponse), + batchUpdateEntitiesMetadata.decode.bind(batchUpdateEntitiesMetadata)), + batchDeleteEntities: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchDeleteEntitiesResponse.decode.bind(batchDeleteEntitiesResponse), + batchDeleteEntitiesMetadata.decode.bind(batchDeleteEntitiesMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.EntityTypes', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.entityTypesStub) { + return this.entityTypesStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.EntityTypes. + this.entityTypesStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.EntityTypes') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.EntityTypes, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const entityTypesStubMethods = + ['listEntityTypes', 'getEntityType', 'createEntityType', 'updateEntityType', 'deleteEntityType', 'batchUpdateEntityTypes', 'batchDeleteEntityTypes', 'batchCreateEntities', 'batchUpdateEntities', 'batchDeleteEntities']; + for (const methodName of entityTypesStubMethods) { + const callPromise = this.entityTypesStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.entityTypesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getEntityType( + request?: protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest|undefined, {}|undefined + ]>; + getEntityType( + request: protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest|null|undefined, + {}|null|undefined>): void; + getEntityType( + request: protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified entity type. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the entity type. + * Format: `projects//agent/entityTypes/`. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @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. + * The first element of the array is an object representing [EntityType]{@link google.cloud.dialogflow.v2.EntityType}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getEntityType(request); + */ + getEntityType( + request?: protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getEntityType(request, options, callback); + } + createEntityType( + request?: protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest|undefined, {}|undefined + ]>; + createEntityType( + request: protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest|null|undefined, + {}|null|undefined>): void; + createEntityType( + request: protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates an entity type in the specified agent. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to create a entity type for. + * Format: `projects//agent`. + * @param {google.cloud.dialogflow.v2.EntityType} request.entityType + * Required. The entity type to create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @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. + * The first element of the array is an object representing [EntityType]{@link google.cloud.dialogflow.v2.EntityType}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createEntityType(request); + */ + createEntityType( + request?: protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createEntityType(request, options, callback); + } + updateEntityType( + request?: protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest|undefined, {}|undefined + ]>; + updateEntityType( + request: protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest|null|undefined, + {}|null|undefined>): void; + updateEntityType( + request: protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified entity type. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.EntityType} request.entityType + * Required. The entity type to update. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @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. + * The first element of the array is an object representing [EntityType]{@link google.cloud.dialogflow.v2.EntityType}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateEntityType(request); + */ + updateEntityType( + request?: protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'entity_type.name': request.entityType!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateEntityType(request, options, callback); + } + deleteEntityType( + request?: protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest|undefined, {}|undefined + ]>; + deleteEntityType( + request: protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest|null|undefined, + {}|null|undefined>): void; + deleteEntityType( + request: protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified entity type. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the entity type to delete. + * Format: `projects//agent/entityTypes/`. + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteEntityType(request); + */ + deleteEntityType( + request?: protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteEntityType(request, options, callback); + } + + batchUpdateEntityTypes( + request?: protos.google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchUpdateEntityTypes( + request: protos.google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchUpdateEntityTypes( + request: protos.google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Updates/Creates multiple entity types in the specified agent. + * + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the agent to update or create entity types in. + * Format: `projects//agent`. + * @param {string} request.entityTypeBatchUri + * The URI to a Google Cloud Storage file containing entity types to update + * or create. The file format can either be a serialized proto (of + * EntityBatch type) or a JSON object. Note: The URI must start with + * "gs://". + * @param {google.cloud.dialogflow.v2.EntityTypeBatch} request.entityTypeBatchInline + * The collection of entity types to update or create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.batchUpdateEntityTypes(request); + * const [response] = await operation.promise(); + */ + batchUpdateEntityTypes( + request?: protos.google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchUpdateEntityTypes(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchUpdateEntityTypes()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkBatchUpdateEntityTypesProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchUpdateEntityTypesProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchUpdateEntityTypes, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + batchDeleteEntityTypes( + request?: protos.google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchDeleteEntityTypes( + request: protos.google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchDeleteEntityTypes( + request: protos.google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Deletes entity types in the specified agent. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the agent to delete all entities types for. Format: + * `projects//agent`. + * @param {string[]} request.entityTypeNames + * Required. The names entity types to delete. All names must point to the + * same agent as `parent`. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.batchDeleteEntityTypes(request); + * const [response] = await operation.promise(); + */ + batchDeleteEntityTypes( + request?: protos.google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchDeleteEntityTypes(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchDeleteEntityTypes()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkBatchDeleteEntityTypesProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchDeleteEntityTypesProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchDeleteEntityTypes, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + batchCreateEntities( + request?: protos.google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchCreateEntities( + request: protos.google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchCreateEntities( + request: protos.google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Creates multiple new entities in the specified entity type. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the entity type to create entities in. Format: + * `projects//agent/entityTypes/`. + * @param {number[]} request.entities + * Required. The entities to create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.batchCreateEntities(request); + * const [response] = await operation.promise(); + */ + batchCreateEntities( + request?: protos.google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchCreateEntities(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchCreateEntities()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkBatchCreateEntitiesProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchCreateEntitiesProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchCreateEntities, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + batchUpdateEntities( + request?: protos.google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchUpdateEntities( + request: protos.google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchUpdateEntities( + request: protos.google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Updates or creates multiple entities in the specified entity type. This + * method does not affect entities in the entity type that aren't explicitly + * specified in the request. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the entity type to update or create entities in. + * Format: `projects//agent/entityTypes/`. + * @param {number[]} request.entities + * Required. The entities to update or create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.batchUpdateEntities(request); + * const [response] = await operation.promise(); + */ + batchUpdateEntities( + request?: protos.google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchUpdateEntities(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchUpdateEntities()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkBatchUpdateEntitiesProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchUpdateEntitiesProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchUpdateEntities, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + batchDeleteEntities( + request?: protos.google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchDeleteEntities( + request: protos.google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchDeleteEntities( + request: protos.google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Deletes entities in the specified entity type. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the entity type to delete entries for. Format: + * `projects//agent/entityTypes/`. + * @param {string[]} request.entityValues + * Required. The reference `values` of the entities to delete. Note that + * these are not fully-qualified names, i.e. they don't start with + * `projects/`. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.batchDeleteEntities(request); + * const [response] = await operation.promise(); + */ + batchDeleteEntities( + request?: protos.google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchDeleteEntities(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchDeleteEntities()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkBatchDeleteEntitiesProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchDeleteEntitiesProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchDeleteEntities, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + listEntityTypes( + request?: protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IEntityType[], + protos.google.cloud.dialogflow.v2.IListEntityTypesRequest|null, + protos.google.cloud.dialogflow.v2.IListEntityTypesResponse + ]>; + listEntityTypes( + request: protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, + protos.google.cloud.dialogflow.v2.IListEntityTypesResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IEntityType>): void; + listEntityTypes( + request: protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, + protos.google.cloud.dialogflow.v2.IListEntityTypesResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IEntityType>): void; +/** + * Returns the list of all entity types in the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all entity types from. + * Format: `projects//agent`. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [EntityType]{@link google.cloud.dialogflow.v2.EntityType}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listEntityTypesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listEntityTypes( + request?: protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, + protos.google.cloud.dialogflow.v2.IListEntityTypesResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IEntityType>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, + protos.google.cloud.dialogflow.v2.IListEntityTypesResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IEntityType>): + Promise<[ + protos.google.cloud.dialogflow.v2.IEntityType[], + protos.google.cloud.dialogflow.v2.IListEntityTypesRequest|null, + protos.google.cloud.dialogflow.v2.IListEntityTypesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listEntityTypes(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all entity types from. + * Format: `projects//agent`. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [EntityType]{@link google.cloud.dialogflow.v2.EntityType} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listEntityTypesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listEntityTypesStream( + request?: protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listEntityTypes.createStream( + this.innerApiCalls.listEntityTypes as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listEntityTypes`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all entity types from. + * Format: `projects//agent`. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [EntityType]{@link google.cloud.dialogflow.v2.EntityType}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listEntityTypesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listEntityTypesAsync( + request?: protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listEntityTypes.asyncIterate( + this.innerApiCalls['listEntityTypes'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.entityTypesStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/entity_types_client_config.json b/owl-bot-staging/v2/src/v2/entity_types_client_config.json new file mode 100644 index 00000000..55fa4026 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/entity_types_client_config.json @@ -0,0 +1,79 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.EntityTypes": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListEntityTypes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchUpdateEntityTypes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchDeleteEntityTypes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchCreateEntities": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchUpdateEntities": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchDeleteEntities": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/entity_types_proto_list.json b/owl-bot-staging/v2/src/v2/entity_types_proto_list.json new file mode 100644 index 00000000..d2ecb25e --- /dev/null +++ b/owl-bot-staging/v2/src/v2/entity_types_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/owl-bot-staging/v2/src/v2/environments_client.ts b/owl-bot-staging/v2/src/v2/environments_client.ts new file mode 100644 index 00000000..45715a03 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/environments_client.ts @@ -0,0 +1,2832 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/environments_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './environments_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.Environment|Environments}. + * @class + * @memberof v2 + */ +export class EnvironmentsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + environmentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of EnvironmentsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof EnvironmentsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listEnvironments: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'environments'), + getEnvironmentHistory: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'entries') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.Environments', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.environmentsStub) { + return this.environmentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.Environments. + this.environmentsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.Environments') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.Environments, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const environmentsStubMethods = + ['listEnvironments', 'getEnvironment', 'createEnvironment', 'updateEnvironment', 'deleteEnvironment', 'getEnvironmentHistory']; + for (const methodName of environmentsStubMethods) { + const callPromise = this.environmentsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.environmentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getEnvironment( + request?: protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest|undefined, {}|undefined + ]>; + getEnvironment( + request: protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest|null|undefined, + {}|null|undefined>): void; + getEnvironment( + request: protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified agent environment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the environment. + * Supported formats: + * + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * + * The environment ID for the default environment is `-`. + * @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. + * The first element of the array is an object representing [Environment]{@link google.cloud.dialogflow.v2.Environment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getEnvironment(request); + */ + getEnvironment( + request?: protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getEnvironment(request, options, callback); + } + createEnvironment( + request?: protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest|undefined, {}|undefined + ]>; + createEnvironment( + request: protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest|null|undefined, + {}|null|undefined>): void; + createEnvironment( + request: protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates an agent environment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to create an environment for. + * Supported formats: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {google.cloud.dialogflow.v2.Environment} request.environment + * Required. The environment to create. + * @param {string} request.environmentId + * Required. The unique id of the new environment. + * @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. + * The first element of the array is an object representing [Environment]{@link google.cloud.dialogflow.v2.Environment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createEnvironment(request); + */ + createEnvironment( + request?: protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createEnvironment(request, options, callback); + } + updateEnvironment( + request?: protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest|undefined, {}|undefined + ]>; + updateEnvironment( + request: protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest|null|undefined, + {}|null|undefined>): void; + updateEnvironment( + request: protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified agent environment. + * + * This method allows you to deploy new agent versions into the environment. + * When an environment is pointed to a new agent version by setting + * `environment.agent_version`, the environment is temporarily set to the + * `LOADING` state. During that time, the environment continues serving the + * previous version of the agent. After the new agent version is done loading, + * the environment is set back to the `RUNNING` state. + * You can use "-" as Environment ID in environment name to update an agent + * version in the default environment. WARNING: this will negate all recent + * changes to the draft agent and can't be undone. You may want to save the + * draft agent to a version before calling this method. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.Environment} request.environment + * Required. The environment to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields get updated. + * @param {boolean} [request.allowLoadToDraftAndDiscardChanges] + * Optional. This field is used to prevent accidental overwrite of the default + * environment, which is an operation that cannot be undone. To confirm that + * the caller desires this overwrite, this field must be explicitly set to + * true when updating the default environment (environment ID = `-`). + * @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. + * The first element of the array is an object representing [Environment]{@link google.cloud.dialogflow.v2.Environment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateEnvironment(request); + */ + updateEnvironment( + request?: protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'environment.name': request.environment!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateEnvironment(request, options, callback); + } + deleteEnvironment( + request?: protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest|undefined, {}|undefined + ]>; + deleteEnvironment( + request: protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest|null|undefined, + {}|null|undefined>): void; + deleteEnvironment( + request: protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified agent environment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the environment to delete. + * / Format: + * + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * + * The environment ID for the default environment is `-`. + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteEnvironment(request); + */ + deleteEnvironment( + request?: protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteEnvironment(request, options, callback); + } + + listEnvironments( + request?: protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IEnvironment[], + protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest|null, + protos.google.cloud.dialogflow.v2.IListEnvironmentsResponse + ]>; + listEnvironments( + request: protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, + protos.google.cloud.dialogflow.v2.IListEnvironmentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IEnvironment>): void; + listEnvironments( + request: protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, + protos.google.cloud.dialogflow.v2.IListEnvironmentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IEnvironment>): void; +/** + * Returns the list of all non-default environments of the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all environments from. + * Format: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [Environment]{@link google.cloud.dialogflow.v2.Environment}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listEnvironmentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listEnvironments( + request?: protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, + protos.google.cloud.dialogflow.v2.IListEnvironmentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IEnvironment>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, + protos.google.cloud.dialogflow.v2.IListEnvironmentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IEnvironment>): + Promise<[ + protos.google.cloud.dialogflow.v2.IEnvironment[], + protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest|null, + protos.google.cloud.dialogflow.v2.IListEnvironmentsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listEnvironments(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all environments from. + * Format: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Environment]{@link google.cloud.dialogflow.v2.Environment} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listEnvironmentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listEnvironmentsStream( + request?: protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listEnvironments.createStream( + this.innerApiCalls.listEnvironments as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listEnvironments`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all environments from. + * Format: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Environment]{@link google.cloud.dialogflow.v2.Environment}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listEnvironmentsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listEnvironmentsAsync( + request?: protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listEnvironments.asyncIterate( + this.innerApiCalls['listEnvironments'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + getEnvironmentHistory( + request?: protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry[], + protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest|null, + protos.google.cloud.dialogflow.v2.IEnvironmentHistory + ]>; + getEnvironmentHistory( + request: protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, + protos.google.cloud.dialogflow.v2.IEnvironmentHistory|null|undefined, + protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry>): void; + getEnvironmentHistory( + request: protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, + protos.google.cloud.dialogflow.v2.IEnvironmentHistory|null|undefined, + protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry>): void; +/** + * Gets the history of the specified environment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the environment to retrieve history for. + * Supported formats: + * + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * + * The environment ID for the default environment is `-`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [Entry]{@link google.cloud.dialogflow.v2.EnvironmentHistory.Entry}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `getEnvironmentHistoryAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + getEnvironmentHistory( + request?: protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, + protos.google.cloud.dialogflow.v2.IEnvironmentHistory|null|undefined, + protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, + protos.google.cloud.dialogflow.v2.IEnvironmentHistory|null|undefined, + protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry>): + Promise<[ + protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry[], + protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest|null, + protos.google.cloud.dialogflow.v2.IEnvironmentHistory + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.getEnvironmentHistory(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the environment to retrieve history for. + * Supported formats: + * + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * + * The environment ID for the default environment is `-`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Entry]{@link google.cloud.dialogflow.v2.EnvironmentHistory.Entry} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `getEnvironmentHistoryAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + getEnvironmentHistoryStream( + request?: protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.getEnvironmentHistory.createStream( + this.innerApiCalls.getEnvironmentHistory as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `getEnvironmentHistory`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the environment to retrieve history for. + * Supported formats: + * + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * + * The environment ID for the default environment is `-`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Entry]{@link google.cloud.dialogflow.v2.EnvironmentHistory.Entry}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.getEnvironmentHistoryAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + getEnvironmentHistoryAsync( + request?: protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.getEnvironmentHistory.asyncIterate( + this.innerApiCalls['getEnvironmentHistory'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.environmentsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/environments_client_config.json b/owl-bot-staging/v2/src/v2/environments_client_config.json new file mode 100644 index 00000000..30cdbacb --- /dev/null +++ b/owl-bot-staging/v2/src/v2/environments_client_config.json @@ -0,0 +1,59 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.Environments": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListEnvironments": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetEnvironment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateEnvironment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateEnvironment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteEnvironment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetEnvironmentHistory": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/environments_proto_list.json b/owl-bot-staging/v2/src/v2/environments_proto_list.json new file mode 100644 index 00000000..d2ecb25e --- /dev/null +++ b/owl-bot-staging/v2/src/v2/environments_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/owl-bot-staging/v2/src/v2/fulfillments_client.ts b/owl-bot-staging/v2/src/v2/fulfillments_client.ts new file mode 100644 index 00000000..0efed62f --- /dev/null +++ b/owl-bot-staging/v2/src/v2/fulfillments_client.ts @@ -0,0 +1,2226 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/fulfillments_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './fulfillments_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.Fulfillment|Fulfillments}. + * @class + * @memberof v2 + */ +export class FulfillmentsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + fulfillmentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of FulfillmentsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof FulfillmentsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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}' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.Fulfillments', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.fulfillmentsStub) { + return this.fulfillmentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.Fulfillments. + this.fulfillmentsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.Fulfillments') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.Fulfillments, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const fulfillmentsStubMethods = + ['getFulfillment', 'updateFulfillment']; + for (const methodName of fulfillmentsStubMethods) { + const callPromise = this.fulfillmentsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.fulfillmentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getFulfillment( + request?: protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IFulfillment, + protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest|undefined, {}|undefined + ]>; + getFulfillment( + request: protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IFulfillment, + protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest|null|undefined, + {}|null|undefined>): void; + getFulfillment( + request: protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IFulfillment, + protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the fulfillment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the fulfillment. + * Format: `projects//agent/fulfillment`. + * @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. + * The first element of the array is an object representing [Fulfillment]{@link google.cloud.dialogflow.v2.Fulfillment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getFulfillment(request); + */ + getFulfillment( + request?: protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IFulfillment, + protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IFulfillment, + protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IFulfillment, + protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getFulfillment(request, options, callback); + } + updateFulfillment( + request?: protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IFulfillment, + protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest|undefined, {}|undefined + ]>; + updateFulfillment( + request: protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IFulfillment, + protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest|null|undefined, + {}|null|undefined>): void; + updateFulfillment( + request: protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IFulfillment, + protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the fulfillment. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.Fulfillment} request.fulfillment + * Required. The fulfillment to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields get updated. If the mask is not + * present, all fields will be updated. + * @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. + * The first element of the array is an object representing [Fulfillment]{@link google.cloud.dialogflow.v2.Fulfillment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateFulfillment(request); + */ + updateFulfillment( + request?: protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IFulfillment, + protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IFulfillment, + protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IFulfillment, + protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'fulfillment.name': request.fulfillment!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateFulfillment(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.fulfillmentsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/fulfillments_client_config.json b/owl-bot-staging/v2/src/v2/fulfillments_client_config.json new file mode 100644 index 00000000..615e86fe --- /dev/null +++ b/owl-bot-staging/v2/src/v2/fulfillments_client_config.json @@ -0,0 +1,39 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.Fulfillments": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "GetFulfillment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateFulfillment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/fulfillments_proto_list.json b/owl-bot-staging/v2/src/v2/fulfillments_proto_list.json new file mode 100644 index 00000000..d2ecb25e --- /dev/null +++ b/owl-bot-staging/v2/src/v2/fulfillments_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/owl-bot-staging/v2/src/v2/gapic_metadata.json b/owl-bot-staging/v2/src/v2/gapic_metadata.json new file mode 100644 index 00000000..56df6aa2 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/gapic_metadata.json @@ -0,0 +1,1094 @@ +{ + "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" + ] + } + } + } + } + }, + "AnswerRecords": { + "clients": { + "grpc": { + "libraryClient": "AnswerRecordsClient", + "rpcs": { + "UpdateAnswerRecord": { + "methods": [ + "updateAnswerRecord" + ] + }, + "ListAnswerRecords": { + "methods": [ + "listAnswerRecords", + "listAnswerRecordsStream", + "listAnswerRecordsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "AnswerRecordsClient", + "rpcs": { + "UpdateAnswerRecord": { + "methods": [ + "updateAnswerRecord" + ] + }, + "ListAnswerRecords": { + "methods": [ + "listAnswerRecords", + "listAnswerRecordsStream", + "listAnswerRecordsAsync" + ] + } + } + } + } + }, + "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" + ] + } + } + } + } + }, + "ConversationProfiles": { + "clients": { + "grpc": { + "libraryClient": "ConversationProfilesClient", + "rpcs": { + "GetConversationProfile": { + "methods": [ + "getConversationProfile" + ] + }, + "CreateConversationProfile": { + "methods": [ + "createConversationProfile" + ] + }, + "UpdateConversationProfile": { + "methods": [ + "updateConversationProfile" + ] + }, + "DeleteConversationProfile": { + "methods": [ + "deleteConversationProfile" + ] + }, + "ListConversationProfiles": { + "methods": [ + "listConversationProfiles", + "listConversationProfilesStream", + "listConversationProfilesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ConversationProfilesClient", + "rpcs": { + "GetConversationProfile": { + "methods": [ + "getConversationProfile" + ] + }, + "CreateConversationProfile": { + "methods": [ + "createConversationProfile" + ] + }, + "UpdateConversationProfile": { + "methods": [ + "updateConversationProfile" + ] + }, + "DeleteConversationProfile": { + "methods": [ + "deleteConversationProfile" + ] + }, + "ListConversationProfiles": { + "methods": [ + "listConversationProfiles", + "listConversationProfilesStream", + "listConversationProfilesAsync" + ] + } + } + } + } + }, + "Conversations": { + "clients": { + "grpc": { + "libraryClient": "ConversationsClient", + "rpcs": { + "CreateConversation": { + "methods": [ + "createConversation" + ] + }, + "GetConversation": { + "methods": [ + "getConversation" + ] + }, + "CompleteConversation": { + "methods": [ + "completeConversation" + ] + }, + "ListConversations": { + "methods": [ + "listConversations", + "listConversationsStream", + "listConversationsAsync" + ] + }, + "ListMessages": { + "methods": [ + "listMessages", + "listMessagesStream", + "listMessagesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ConversationsClient", + "rpcs": { + "CreateConversation": { + "methods": [ + "createConversation" + ] + }, + "GetConversation": { + "methods": [ + "getConversation" + ] + }, + "CompleteConversation": { + "methods": [ + "completeConversation" + ] + }, + "ListConversations": { + "methods": [ + "listConversations", + "listConversationsStream", + "listConversationsAsync" + ] + }, + "ListMessages": { + "methods": [ + "listMessages", + "listMessagesStream", + "listMessagesAsync" + ] + } + } + } + } + }, + "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": { + "GetEnvironment": { + "methods": [ + "getEnvironment" + ] + }, + "CreateEnvironment": { + "methods": [ + "createEnvironment" + ] + }, + "UpdateEnvironment": { + "methods": [ + "updateEnvironment" + ] + }, + "DeleteEnvironment": { + "methods": [ + "deleteEnvironment" + ] + }, + "ListEnvironments": { + "methods": [ + "listEnvironments", + "listEnvironmentsStream", + "listEnvironmentsAsync" + ] + }, + "GetEnvironmentHistory": { + "methods": [ + "getEnvironmentHistory", + "getEnvironmentHistoryStream", + "getEnvironmentHistoryAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "EnvironmentsClient", + "rpcs": { + "GetEnvironment": { + "methods": [ + "getEnvironment" + ] + }, + "CreateEnvironment": { + "methods": [ + "createEnvironment" + ] + }, + "UpdateEnvironment": { + "methods": [ + "updateEnvironment" + ] + }, + "DeleteEnvironment": { + "methods": [ + "deleteEnvironment" + ] + }, + "ListEnvironments": { + "methods": [ + "listEnvironments", + "listEnvironmentsStream", + "listEnvironmentsAsync" + ] + }, + "GetEnvironmentHistory": { + "methods": [ + "getEnvironmentHistory", + "getEnvironmentHistoryStream", + "getEnvironmentHistoryAsync" + ] + } + } + } + } + }, + "Fulfillments": { + "clients": { + "grpc": { + "libraryClient": "FulfillmentsClient", + "rpcs": { + "GetFulfillment": { + "methods": [ + "getFulfillment" + ] + }, + "UpdateFulfillment": { + "methods": [ + "updateFulfillment" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "FulfillmentsClient", + "rpcs": { + "GetFulfillment": { + "methods": [ + "getFulfillment" + ] + }, + "UpdateFulfillment": { + "methods": [ + "updateFulfillment" + ] + } + } + } + } + }, + "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" + ] + } + } + } + } + }, + "Participants": { + "clients": { + "grpc": { + "libraryClient": "ParticipantsClient", + "rpcs": { + "CreateParticipant": { + "methods": [ + "createParticipant" + ] + }, + "GetParticipant": { + "methods": [ + "getParticipant" + ] + }, + "UpdateParticipant": { + "methods": [ + "updateParticipant" + ] + }, + "AnalyzeContent": { + "methods": [ + "analyzeContent" + ] + }, + "SuggestArticles": { + "methods": [ + "suggestArticles" + ] + }, + "SuggestFaqAnswers": { + "methods": [ + "suggestFaqAnswers" + ] + }, + "ListParticipants": { + "methods": [ + "listParticipants", + "listParticipantsStream", + "listParticipantsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ParticipantsClient", + "rpcs": { + "CreateParticipant": { + "methods": [ + "createParticipant" + ] + }, + "GetParticipant": { + "methods": [ + "getParticipant" + ] + }, + "UpdateParticipant": { + "methods": [ + "updateParticipant" + ] + }, + "AnalyzeContent": { + "methods": [ + "analyzeContent" + ] + }, + "SuggestArticles": { + "methods": [ + "suggestArticles" + ] + }, + "SuggestFaqAnswers": { + "methods": [ + "suggestFaqAnswers" + ] + }, + "ListParticipants": { + "methods": [ + "listParticipants", + "listParticipantsStream", + "listParticipantsAsync" + ] + } + } + } + } + }, + "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" + ] + } + } + } + } + }, + "Versions": { + "clients": { + "grpc": { + "libraryClient": "VersionsClient", + "rpcs": { + "GetVersion": { + "methods": [ + "getVersion" + ] + }, + "CreateVersion": { + "methods": [ + "createVersion" + ] + }, + "UpdateVersion": { + "methods": [ + "updateVersion" + ] + }, + "DeleteVersion": { + "methods": [ + "deleteVersion" + ] + }, + "ListVersions": { + "methods": [ + "listVersions", + "listVersionsStream", + "listVersionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "VersionsClient", + "rpcs": { + "GetVersion": { + "methods": [ + "getVersion" + ] + }, + "CreateVersion": { + "methods": [ + "createVersion" + ] + }, + "UpdateVersion": { + "methods": [ + "updateVersion" + ] + }, + "DeleteVersion": { + "methods": [ + "deleteVersion" + ] + }, + "ListVersions": { + "methods": [ + "listVersions", + "listVersionsStream", + "listVersionsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/index.ts b/owl-bot-staging/v2/src/v2/index.ts new file mode 100644 index 00000000..7214e5d9 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/index.ts @@ -0,0 +1,33 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {AgentsClient} from './agents_client'; +export {AnswerRecordsClient} from './answer_records_client'; +export {ContextsClient} from './contexts_client'; +export {ConversationProfilesClient} from './conversation_profiles_client'; +export {ConversationsClient} from './conversations_client'; +export {DocumentsClient} from './documents_client'; +export {EntityTypesClient} from './entity_types_client'; +export {EnvironmentsClient} from './environments_client'; +export {FulfillmentsClient} from './fulfillments_client'; +export {IntentsClient} from './intents_client'; +export {KnowledgeBasesClient} from './knowledge_bases_client'; +export {ParticipantsClient} from './participants_client'; +export {SessionEntityTypesClient} from './session_entity_types_client'; +export {SessionsClient} from './sessions_client'; +export {VersionsClient} from './versions_client'; diff --git a/owl-bot-staging/v2/src/v2/intents_client.ts b/owl-bot-staging/v2/src/v2/intents_client.ts new file mode 100644 index 00000000..368ae75c --- /dev/null +++ b/owl-bot-staging/v2/src/v2/intents_client.ts @@ -0,0 +1,2927 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/intents_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './intents_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.Intent|Intents}. + * @class + * @memberof v2 + */ +export class IntentsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + intentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of IntentsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof IntentsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listIntents: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'intents') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + + this.operationsClient = this._gaxModule.lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }).operationsClient(opts); + const batchUpdateIntentsResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.BatchUpdateIntentsResponse') as gax.protobuf.Type; + const batchUpdateIntentsMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + const batchDeleteIntentsResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const batchDeleteIntentsMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + + this.descriptors.longrunning = { + batchUpdateIntents: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchUpdateIntentsResponse.decode.bind(batchUpdateIntentsResponse), + batchUpdateIntentsMetadata.decode.bind(batchUpdateIntentsMetadata)), + batchDeleteIntents: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchDeleteIntentsResponse.decode.bind(batchDeleteIntentsResponse), + batchDeleteIntentsMetadata.decode.bind(batchDeleteIntentsMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.Intents', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.intentsStub) { + return this.intentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.Intents. + this.intentsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.Intents') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.Intents, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const intentsStubMethods = + ['listIntents', 'getIntent', 'createIntent', 'updateIntent', 'deleteIntent', 'batchUpdateIntents', 'batchDeleteIntents']; + for (const methodName of intentsStubMethods) { + const callPromise = this.intentsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.intentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getIntent( + request?: protos.google.cloud.dialogflow.v2.IGetIntentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IGetIntentRequest|undefined, {}|undefined + ]>; + getIntent( + request: protos.google.cloud.dialogflow.v2.IGetIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IGetIntentRequest|null|undefined, + {}|null|undefined>): void; + getIntent( + request: protos.google.cloud.dialogflow.v2.IGetIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IGetIntentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified intent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the intent. + * Format: `projects//agent/intents/`. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] + * Optional. The resource view to apply to the returned intent. + * @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. + * The first element of the array is an object representing [Intent]{@link google.cloud.dialogflow.v2.Intent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getIntent(request); + */ + getIntent( + request?: protos.google.cloud.dialogflow.v2.IGetIntentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IGetIntentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IGetIntentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IGetIntentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getIntent(request, options, callback); + } + createIntent( + request?: protos.google.cloud.dialogflow.v2.ICreateIntentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.ICreateIntentRequest|undefined, {}|undefined + ]>; + createIntent( + request: protos.google.cloud.dialogflow.v2.ICreateIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.ICreateIntentRequest|null|undefined, + {}|null|undefined>): void; + createIntent( + request: protos.google.cloud.dialogflow.v2.ICreateIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.ICreateIntentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates an intent in the specified agent. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to create a intent for. + * Format: `projects//agent`. + * @param {google.cloud.dialogflow.v2.Intent} request.intent + * Required. The intent to create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] + * Optional. The resource view to apply to the returned intent. + * @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. + * The first element of the array is an object representing [Intent]{@link google.cloud.dialogflow.v2.Intent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createIntent(request); + */ + createIntent( + request?: protos.google.cloud.dialogflow.v2.ICreateIntentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.ICreateIntentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.ICreateIntentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.ICreateIntentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createIntent(request, options, callback); + } + updateIntent( + request?: protos.google.cloud.dialogflow.v2.IUpdateIntentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IUpdateIntentRequest|undefined, {}|undefined + ]>; + updateIntent( + request: protos.google.cloud.dialogflow.v2.IUpdateIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IUpdateIntentRequest|null|undefined, + {}|null|undefined>): void; + updateIntent( + request: protos.google.cloud.dialogflow.v2.IUpdateIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IUpdateIntentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified intent. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.Intent} request.intent + * Required. The intent to update. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] + * Optional. The resource view to apply to the returned intent. + * @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. + * The first element of the array is an object representing [Intent]{@link google.cloud.dialogflow.v2.Intent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateIntent(request); + */ + updateIntent( + request?: protos.google.cloud.dialogflow.v2.IUpdateIntentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IUpdateIntentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IUpdateIntentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IUpdateIntentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'intent.name': request.intent!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateIntent(request, options, callback); + } + deleteIntent( + request?: protos.google.cloud.dialogflow.v2.IDeleteIntentRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteIntentRequest|undefined, {}|undefined + ]>; + deleteIntent( + request: protos.google.cloud.dialogflow.v2.IDeleteIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteIntentRequest|null|undefined, + {}|null|undefined>): void; + deleteIntent( + request: protos.google.cloud.dialogflow.v2.IDeleteIntentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteIntentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified intent and its direct or indirect followup intents. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the intent to delete. If this intent has direct or + * indirect followup intents, we also delete them. + * Format: `projects//agent/intents/`. + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteIntent(request); + */ + deleteIntent( + request?: protos.google.cloud.dialogflow.v2.IDeleteIntentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteIntentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteIntentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteIntentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteIntent(request, options, callback); + } + + batchUpdateIntents( + request?: protos.google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchUpdateIntents( + request: protos.google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchUpdateIntents( + request: protos.google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Updates/Creates multiple intents in the specified agent. + * + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the agent to update or create intents in. + * Format: `projects//agent`. + * @param {string} request.intentBatchUri + * The URI to a Google Cloud Storage file containing intents to update or + * create. The file format can either be a serialized proto (of IntentBatch + * type) or JSON object. Note: The URI must start with "gs://". + * @param {google.cloud.dialogflow.v2.IntentBatch} request.intentBatchInline + * The collection of intents to update or create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] + * Optional. The resource view to apply to the returned intent. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.batchUpdateIntents(request); + * const [response] = await operation.promise(); + */ + batchUpdateIntents( + request?: protos.google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchUpdateIntents(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchUpdateIntents()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkBatchUpdateIntentsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchUpdateIntentsProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchUpdateIntents, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + batchDeleteIntents( + request?: protos.google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchDeleteIntents( + request: protos.google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchDeleteIntents( + request: protos.google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Deletes intents in the specified agent. + * + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the agent to delete all entities types for. Format: + * `projects//agent`. + * @param {number[]} request.intents + * Required. The collection of intents to delete. Only intent `name` must be + * filled in. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.batchDeleteIntents(request); + * const [response] = await operation.promise(); + */ + batchDeleteIntents( + request?: protos.google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchDeleteIntents(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchDeleteIntents()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkBatchDeleteIntentsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchDeleteIntentsProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchDeleteIntents, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + listIntents( + request?: protos.google.cloud.dialogflow.v2.IListIntentsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IIntent[], + protos.google.cloud.dialogflow.v2.IListIntentsRequest|null, + protos.google.cloud.dialogflow.v2.IListIntentsResponse + ]>; + listIntents( + request: protos.google.cloud.dialogflow.v2.IListIntentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListIntentsRequest, + protos.google.cloud.dialogflow.v2.IListIntentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IIntent>): void; + listIntents( + request: protos.google.cloud.dialogflow.v2.IListIntentsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListIntentsRequest, + protos.google.cloud.dialogflow.v2.IListIntentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IIntent>): void; +/** + * Returns the list of all intents in the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all intents from. + * Format: `projects//agent` or `projects//locations//agent`. + * + * Alternatively, you can specify the environment to list intents for. + * Format: `projects//agent/environments/` + * or `projects//locations//agent/environments/`. + * Note: training phrases of the intents will not be returned for non-draft + * environment. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] + * Optional. The resource view to apply to the returned intent. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [Intent]{@link google.cloud.dialogflow.v2.Intent}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listIntentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listIntents( + request?: protos.google.cloud.dialogflow.v2.IListIntentsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2.IListIntentsRequest, + protos.google.cloud.dialogflow.v2.IListIntentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IIntent>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListIntentsRequest, + protos.google.cloud.dialogflow.v2.IListIntentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IIntent>): + Promise<[ + protos.google.cloud.dialogflow.v2.IIntent[], + protos.google.cloud.dialogflow.v2.IListIntentsRequest|null, + protos.google.cloud.dialogflow.v2.IListIntentsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listIntents(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all intents from. + * Format: `projects//agent` or `projects//locations//agent`. + * + * Alternatively, you can specify the environment to list intents for. + * Format: `projects//agent/environments/` + * or `projects//locations//agent/environments/`. + * Note: training phrases of the intents will not be returned for non-draft + * environment. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] + * Optional. The resource view to apply to the returned intent. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Intent]{@link google.cloud.dialogflow.v2.Intent} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listIntentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listIntentsStream( + request?: protos.google.cloud.dialogflow.v2.IListIntentsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listIntents.createStream( + this.innerApiCalls.listIntents as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listIntents`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all intents from. + * Format: `projects//agent` or `projects//locations//agent`. + * + * Alternatively, you can specify the environment to list intents for. + * Format: `projects//agent/environments/` + * or `projects//locations//agent/environments/`. + * Note: training phrases of the intents will not be returned for non-draft + * environment. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] + * Optional. The resource view to apply to the returned intent. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Intent]{@link google.cloud.dialogflow.v2.Intent}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listIntentsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listIntentsAsync( + request?: protos.google.cloud.dialogflow.v2.IListIntentsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listIntents.asyncIterate( + this.innerApiCalls['listIntents'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.intentsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/intents_client_config.json b/owl-bot-staging/v2/src/v2/intents_client_config.json new file mode 100644 index 00000000..ad20f4c6 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/intents_client_config.json @@ -0,0 +1,64 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.Intents": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListIntents": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchUpdateIntents": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchDeleteIntents": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/intents_proto_list.json b/owl-bot-staging/v2/src/v2/intents_proto_list.json new file mode 100644 index 00000000..d2ecb25e --- /dev/null +++ b/owl-bot-staging/v2/src/v2/intents_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/owl-bot-staging/v2/src/v2/knowledge_bases_client.ts b/owl-bot-staging/v2/src/v2/knowledge_bases_client.ts new file mode 100644 index 00000000..b93c6666 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/knowledge_bases_client.ts @@ -0,0 +1,2596 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/knowledge_bases_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './knowledge_bases_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.KnowledgeBase|KnowledgeBases}. + * @class + * @memberof v2 + */ +export class KnowledgeBasesClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + knowledgeBasesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of KnowledgeBasesClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof KnowledgeBasesClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listKnowledgeBases: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'knowledgeBases') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.KnowledgeBases', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.knowledgeBasesStub) { + return this.knowledgeBasesStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.KnowledgeBases. + this.knowledgeBasesStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.KnowledgeBases') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.KnowledgeBases, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const knowledgeBasesStubMethods = + ['listKnowledgeBases', 'getKnowledgeBase', 'createKnowledgeBase', 'deleteKnowledgeBase', 'updateKnowledgeBase']; + for (const methodName of knowledgeBasesStubMethods) { + const callPromise = this.knowledgeBasesStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.knowledgeBasesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest|undefined, {}|undefined + ]>; + getKnowledgeBase( + request: protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): void; + getKnowledgeBase( + request: protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified knowledge base. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the knowledge base to retrieve. + * 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. + * The first element of the array is an object representing [KnowledgeBase]{@link google.cloud.dialogflow.v2.KnowledgeBase}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getKnowledgeBase(request); + */ + getKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getKnowledgeBase(request, options, callback); + } + createKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest|undefined, {}|undefined + ]>; + createKnowledgeBase( + request: protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): void; + createKnowledgeBase( + request: protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a knowledge base. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to create a knowledge base for. + * Format: `projects//locations/`. + * @param {google.cloud.dialogflow.v2.KnowledgeBase} request.knowledgeBase + * Required. The knowledge base to create. + * @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. + * The first element of the array is an object representing [KnowledgeBase]{@link google.cloud.dialogflow.v2.KnowledgeBase}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createKnowledgeBase(request); + */ + createKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createKnowledgeBase(request, options, callback); + } + deleteKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest|undefined, {}|undefined + ]>; + deleteKnowledgeBase( + request: protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): void; + deleteKnowledgeBase( + request: protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified knowledge base. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the knowledge base to delete. + * 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. + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteKnowledgeBase(request); + */ + deleteKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteKnowledgeBase(request, options, callback); + } + updateKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest|undefined, {}|undefined + ]>; + updateKnowledgeBase( + request: protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): void; + updateKnowledgeBase( + request: protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified knowledge base. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.KnowledgeBase} request.knowledgeBase + * Required. The knowledge base to update. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Not specified means `update all`. + * Currently, only `display_name` can be updated, an InvalidArgument will be + * returned for attempting to update other fields. + * @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. + * The first element of the array is an object representing [KnowledgeBase]{@link google.cloud.dialogflow.v2.KnowledgeBase}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateKnowledgeBase(request); + */ + updateKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'knowledge_base.name': request.knowledgeBase!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateKnowledgeBase(request, options, callback); + } + + listKnowledgeBases( + request?: protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IKnowledgeBase[], + protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest|null, + protos.google.cloud.dialogflow.v2.IListKnowledgeBasesResponse + ]>; + listKnowledgeBases( + request: protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, + protos.google.cloud.dialogflow.v2.IListKnowledgeBasesResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IKnowledgeBase>): void; + listKnowledgeBases( + request: protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, + protos.google.cloud.dialogflow.v2.IListKnowledgeBasesResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IKnowledgeBase>): void; +/** + * Returns the list of all knowledge bases of the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list of knowledge bases for. + * 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. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [KnowledgeBase]{@link google.cloud.dialogflow.v2.KnowledgeBase}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listKnowledgeBasesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listKnowledgeBases( + request?: protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, + protos.google.cloud.dialogflow.v2.IListKnowledgeBasesResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IKnowledgeBase>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, + protos.google.cloud.dialogflow.v2.IListKnowledgeBasesResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IKnowledgeBase>): + Promise<[ + protos.google.cloud.dialogflow.v2.IKnowledgeBase[], + protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest|null, + protos.google.cloud.dialogflow.v2.IListKnowledgeBasesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listKnowledgeBases(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list of knowledge bases for. + * 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. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [KnowledgeBase]{@link google.cloud.dialogflow.v2.KnowledgeBase} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listKnowledgeBasesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listKnowledgeBasesStream( + request?: protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listKnowledgeBases.createStream( + this.innerApiCalls.listKnowledgeBases as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listKnowledgeBases`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list of knowledge bases for. + * 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. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [KnowledgeBase]{@link google.cloud.dialogflow.v2.KnowledgeBase}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listKnowledgeBasesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listKnowledgeBasesAsync( + request?: protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listKnowledgeBases.asyncIterate( + this.innerApiCalls['listKnowledgeBases'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.knowledgeBasesStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/knowledge_bases_client_config.json b/owl-bot-staging/v2/src/v2/knowledge_bases_client_config.json new file mode 100644 index 00000000..580ef4d8 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/knowledge_bases_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.KnowledgeBases": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListKnowledgeBases": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetKnowledgeBase": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateKnowledgeBase": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteKnowledgeBase": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateKnowledgeBase": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/knowledge_bases_proto_list.json b/owl-bot-staging/v2/src/v2/knowledge_bases_proto_list.json new file mode 100644 index 00000000..d2ecb25e --- /dev/null +++ b/owl-bot-staging/v2/src/v2/knowledge_bases_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/owl-bot-staging/v2/src/v2/participants_client.ts b/owl-bot-staging/v2/src/v2/participants_client.ts new file mode 100644 index 00000000..dd05351d --- /dev/null +++ b/owl-bot-staging/v2/src/v2/participants_client.ts @@ -0,0 +1,2784 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/participants_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './participants_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.Participant|Participants}. + * @class + * @memberof v2 + */ +export class ParticipantsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + participantsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ParticipantsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ParticipantsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listParticipants: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'participants') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.Participants', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.participantsStub) { + return this.participantsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.Participants. + this.participantsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.Participants') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.Participants, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const participantsStubMethods = + ['createParticipant', 'getParticipant', 'listParticipants', 'updateParticipant', 'analyzeContent', 'suggestArticles', 'suggestFaqAnswers']; + for (const methodName of participantsStubMethods) { + const callPromise = this.participantsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.participantsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createParticipant( + request?: protos.google.cloud.dialogflow.v2.ICreateParticipantRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.ICreateParticipantRequest|undefined, {}|undefined + ]>; + createParticipant( + request: protos.google.cloud.dialogflow.v2.ICreateParticipantRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.ICreateParticipantRequest|null|undefined, + {}|null|undefined>): void; + createParticipant( + request: protos.google.cloud.dialogflow.v2.ICreateParticipantRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.ICreateParticipantRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a new participant in a conversation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource identifier of the conversation adding the participant. + * Format: `projects//locations//conversations/`. + * @param {google.cloud.dialogflow.v2.Participant} request.participant + * Required. The participant to create. + * @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. + * The first element of the array is an object representing [Participant]{@link google.cloud.dialogflow.v2.Participant}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createParticipant(request); + */ + createParticipant( + request?: protos.google.cloud.dialogflow.v2.ICreateParticipantRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.ICreateParticipantRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.ICreateParticipantRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.ICreateParticipantRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createParticipant(request, options, callback); + } + getParticipant( + request?: protos.google.cloud.dialogflow.v2.IGetParticipantRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.IGetParticipantRequest|undefined, {}|undefined + ]>; + getParticipant( + request: protos.google.cloud.dialogflow.v2.IGetParticipantRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.IGetParticipantRequest|null|undefined, + {}|null|undefined>): void; + getParticipant( + request: protos.google.cloud.dialogflow.v2.IGetParticipantRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.IGetParticipantRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves a conversation participant. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the participant. Format: + * `projects//locations//conversations//participants/`. + * @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. + * The first element of the array is an object representing [Participant]{@link google.cloud.dialogflow.v2.Participant}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getParticipant(request); + */ + getParticipant( + request?: protos.google.cloud.dialogflow.v2.IGetParticipantRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.IGetParticipantRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.IGetParticipantRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.IGetParticipantRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getParticipant(request, options, callback); + } + updateParticipant( + request?: protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest|undefined, {}|undefined + ]>; + updateParticipant( + request: protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest|null|undefined, + {}|null|undefined>): void; + updateParticipant( + request: protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified participant. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.Participant} request.participant + * Required. The participant to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to specify which fields to update. + * @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. + * The first element of the array is an object representing [Participant]{@link google.cloud.dialogflow.v2.Participant}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateParticipant(request); + */ + updateParticipant( + request?: protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'participant.name': request.participant!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateParticipant(request, options, callback); + } + analyzeContent( + request?: protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse, + protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest|undefined, {}|undefined + ]>; + analyzeContent( + request: protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse, + protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest|null|undefined, + {}|null|undefined>): void; + analyzeContent( + request: protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse, + protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Adds a text (chat, for example), or audio (phone recording, for example) + * message from a participant into the conversation. + * + * Note: Always use agent versions for production traffic + * sent to virtual agents. 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.participant + * Required. The name of the participant this text comes from. + * Format: `projects//locations//conversations//participants/`. + * @param {google.cloud.dialogflow.v2.TextInput} request.textInput + * The natural language text to be processed. + * @param {google.cloud.dialogflow.v2.EventInput} request.eventInput + * An input event to send to Dialogflow. + * @param {google.cloud.dialogflow.v2.OutputAudioConfig} request.replyAudioConfig + * Speech synthesis configuration. + * The speech synthesis settings for a virtual agent that may be configured + * for the associated conversation profile are not used when calling + * AnalyzeContent. If this configuration is not supplied, speech synthesis + * is disabled. + * @param {google.cloud.dialogflow.v2.QueryParameters} request.queryParams + * Parameters for a Dialogflow virtual-agent query. + * @param {string} request.requestId + * A unique identifier for this request. Restricted to 36 ASCII characters. + * A random UUID is recommended. + * This request is only idempotent if a `request_id` is provided. + * @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. + * The first element of the array is an object representing [AnalyzeContentResponse]{@link google.cloud.dialogflow.v2.AnalyzeContentResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.analyzeContent(request); + */ + analyzeContent( + request?: protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse, + protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse, + protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse, + protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'participant': request.participant || '', + }); + this.initialize(); + return this.innerApiCalls.analyzeContent(request, options, callback); + } + suggestArticles( + request?: protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse, + protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest|undefined, {}|undefined + ]>; + suggestArticles( + request: protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse, + protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest|null|undefined, + {}|null|undefined>): void; + suggestArticles( + request: protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse, + protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest|null|undefined, + {}|null|undefined>): void; +/** + * Gets suggested articles for a participant based on specific historical + * messages. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + * @param {string} request.latestMessage + * The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * + * Format: `projects//locations//conversations//messages/`. + * @param {number} request.contextSize + * Max number of messages prior to and including + * {@link google.cloud.dialogflow.v2.SuggestArticlesRequest.latest_message|latest_message} to use as context + * when compiling the suggestion. By default 20 and at most 50. + * @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. + * The first element of the array is an object representing [SuggestArticlesResponse]{@link google.cloud.dialogflow.v2.SuggestArticlesResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.suggestArticles(request); + */ + suggestArticles( + request?: protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse, + protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse, + protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse, + protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.suggestArticles(request, options, callback); + } + suggestFaqAnswers( + request?: protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse, + protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest|undefined, {}|undefined + ]>; + suggestFaqAnswers( + request: protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse, + protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest|null|undefined, + {}|null|undefined>): void; + suggestFaqAnswers( + request: protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse, + protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest|null|undefined, + {}|null|undefined>): void; +/** + * Gets suggested faq answers for a participant based on specific historical + * messages. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + * @param {string} request.latestMessage + * The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * + * Format: `projects//locations//conversations//messages/`. + * @param {number} request.contextSize + * Max number of messages prior to and including + * [latest_message] to use as context when compiling the + * suggestion. By default 20 and at most 50. + * @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. + * The first element of the array is an object representing [SuggestFaqAnswersResponse]{@link google.cloud.dialogflow.v2.SuggestFaqAnswersResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.suggestFaqAnswers(request); + */ + suggestFaqAnswers( + request?: protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse, + protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse, + protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse, + protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.suggestFaqAnswers(request, options, callback); + } + + listParticipants( + request?: protos.google.cloud.dialogflow.v2.IListParticipantsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IParticipant[], + protos.google.cloud.dialogflow.v2.IListParticipantsRequest|null, + protos.google.cloud.dialogflow.v2.IListParticipantsResponse + ]>; + listParticipants( + request: protos.google.cloud.dialogflow.v2.IListParticipantsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListParticipantsRequest, + protos.google.cloud.dialogflow.v2.IListParticipantsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IParticipant>): void; + listParticipants( + request: protos.google.cloud.dialogflow.v2.IListParticipantsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListParticipantsRequest, + protos.google.cloud.dialogflow.v2.IListParticipantsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IParticipant>): void; +/** + * Returns the list of all participants in the specified conversation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The conversation to list all participants from. + * Format: `projects//locations//conversations/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [Participant]{@link google.cloud.dialogflow.v2.Participant}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listParticipantsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listParticipants( + request?: protos.google.cloud.dialogflow.v2.IListParticipantsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2.IListParticipantsRequest, + protos.google.cloud.dialogflow.v2.IListParticipantsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IParticipant>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListParticipantsRequest, + protos.google.cloud.dialogflow.v2.IListParticipantsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IParticipant>): + Promise<[ + protos.google.cloud.dialogflow.v2.IParticipant[], + protos.google.cloud.dialogflow.v2.IListParticipantsRequest|null, + protos.google.cloud.dialogflow.v2.IListParticipantsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listParticipants(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The conversation to list all participants from. + * Format: `projects//locations//conversations/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Participant]{@link google.cloud.dialogflow.v2.Participant} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listParticipantsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listParticipantsStream( + request?: protos.google.cloud.dialogflow.v2.IListParticipantsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listParticipants.createStream( + this.innerApiCalls.listParticipants as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listParticipants`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The conversation to list all participants from. + * Format: `projects//locations//conversations/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Participant]{@link google.cloud.dialogflow.v2.Participant}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listParticipantsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listParticipantsAsync( + request?: protos.google.cloud.dialogflow.v2.IListParticipantsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listParticipants.asyncIterate( + this.innerApiCalls['listParticipants'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.participantsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/participants_client_config.json b/owl-bot-staging/v2/src/v2/participants_client_config.json new file mode 100644 index 00000000..5a688201 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/participants_client_config.json @@ -0,0 +1,64 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.Participants": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateParticipant": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetParticipant": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListParticipants": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateParticipant": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "AnalyzeContent": { + "timeout_millis": 220000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SuggestArticles": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SuggestFaqAnswers": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/participants_proto_list.json b/owl-bot-staging/v2/src/v2/participants_proto_list.json new file mode 100644 index 00000000..d2ecb25e --- /dev/null +++ b/owl-bot-staging/v2/src/v2/participants_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/owl-bot-staging/v2/src/v2/session_entity_types_client.ts b/owl-bot-staging/v2/src/v2/session_entity_types_client.ts new file mode 100644 index 00000000..ea94243f --- /dev/null +++ b/owl-bot-staging/v2/src/v2/session_entity_types_client.ts @@ -0,0 +1,2677 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/session_entity_types_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './session_entity_types_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.SessionEntityType|SessionEntityTypes}. + * @class + * @memberof v2 + */ +export class SessionEntityTypesClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + sessionEntityTypesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SessionEntityTypesClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SessionEntityTypesClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listSessionEntityTypes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sessionEntityTypes') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.SessionEntityTypes', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sessionEntityTypesStub) { + return this.sessionEntityTypesStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.SessionEntityTypes. + this.sessionEntityTypesStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.SessionEntityTypes') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.SessionEntityTypes, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sessionEntityTypesStubMethods = + ['listSessionEntityTypes', 'getSessionEntityType', 'createSessionEntityType', 'updateSessionEntityType', 'deleteSessionEntityType']; + for (const methodName of sessionEntityTypesStubMethods) { + const callPromise = this.sessionEntityTypesStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sessionEntityTypesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getSessionEntityType( + request?: protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.ISessionEntityType, + protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest|undefined, {}|undefined + ]>; + getSessionEntityType( + request: protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): void; + getSessionEntityType( + request: protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified session entity type. + * + * This method doesn't work with Google Assistant integration. + * Contact Dialogflow support if you need to use session entities + * with Google Assistant integration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the session entity type. Format: + * `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @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. + * The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getSessionEntityType(request); + */ + getSessionEntityType( + request?: protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.ISessionEntityType, + protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getSessionEntityType(request, options, callback); + } + createSessionEntityType( + request?: protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.ISessionEntityType, + protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest|undefined, {}|undefined + ]>; + createSessionEntityType( + request: protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): void; + createSessionEntityType( + request: protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a session entity type. + * + * If the specified session entity type already exists, overrides the session + * entity type. + * + * This method doesn't work with Google Assistant integration. + * Contact Dialogflow support if you need to use session entities + * with Google Assistant integration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to create a session entity type for. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users// + * sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @param {google.cloud.dialogflow.v2.SessionEntityType} request.sessionEntityType + * Required. The session entity type to create. + * @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. + * The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createSessionEntityType(request); + */ + createSessionEntityType( + request?: protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.ISessionEntityType, + protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createSessionEntityType(request, options, callback); + } + updateSessionEntityType( + request?: protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.ISessionEntityType, + protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest|undefined, {}|undefined + ]>; + updateSessionEntityType( + request: protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): void; + updateSessionEntityType( + request: protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified session entity type. + * + * This method doesn't work with Google Assistant integration. + * Contact Dialogflow support if you need to use session entities + * with Google Assistant integration. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.SessionEntityType} request.sessionEntityType + * Required. The session entity type to update. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @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. + * The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateSessionEntityType(request); + */ + updateSessionEntityType( + request?: protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.ISessionEntityType, + protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'session_entity_type.name': request.sessionEntityType!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateSessionEntityType(request, options, callback); + } + deleteSessionEntityType( + request?: protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest|undefined, {}|undefined + ]>; + deleteSessionEntityType( + request: protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): void; + deleteSessionEntityType( + request: protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified session entity type. + * + * This method doesn't work with Google Assistant integration. + * Contact Dialogflow support if you need to use session entities + * with Google Assistant integration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the entity type to delete. Format: + * `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteSessionEntityType(request); + */ + deleteSessionEntityType( + request?: protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteSessionEntityType(request, options, callback); + } + + listSessionEntityTypes( + request?: protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.ISessionEntityType[], + protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest|null, + protos.google.cloud.dialogflow.v2.IListSessionEntityTypesResponse + ]>; + listSessionEntityTypes( + request: protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, + protos.google.cloud.dialogflow.v2.IListSessionEntityTypesResponse|null|undefined, + protos.google.cloud.dialogflow.v2.ISessionEntityType>): void; + listSessionEntityTypes( + request: protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, + protos.google.cloud.dialogflow.v2.IListSessionEntityTypesResponse|null|undefined, + protos.google.cloud.dialogflow.v2.ISessionEntityType>): void; +/** + * Returns the list of all session entity types in the specified session. + * + * This method doesn't work with Google Assistant integration. + * Contact Dialogflow support if you need to use session entities + * with Google Assistant integration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to list all session entity types from. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users// + * sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listSessionEntityTypesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listSessionEntityTypes( + request?: protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, + protos.google.cloud.dialogflow.v2.IListSessionEntityTypesResponse|null|undefined, + protos.google.cloud.dialogflow.v2.ISessionEntityType>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, + protos.google.cloud.dialogflow.v2.IListSessionEntityTypesResponse|null|undefined, + protos.google.cloud.dialogflow.v2.ISessionEntityType>): + Promise<[ + protos.google.cloud.dialogflow.v2.ISessionEntityType[], + protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest|null, + protos.google.cloud.dialogflow.v2.IListSessionEntityTypesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listSessionEntityTypes(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to list all session entity types from. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users// + * sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listSessionEntityTypesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listSessionEntityTypesStream( + request?: protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listSessionEntityTypes.createStream( + this.innerApiCalls.listSessionEntityTypes as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSessionEntityTypes`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to list all session entity types from. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users// + * sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listSessionEntityTypesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listSessionEntityTypesAsync( + request?: protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listSessionEntityTypes.asyncIterate( + this.innerApiCalls['listSessionEntityTypes'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSession resource name string. + * + * @param {string} project + * @param {string} session + * @returns {string} Resource name string. + */ + projectAgentSessionPath(project:string,session:string) { + return this.pathTemplates.projectAgentSessionPathTemplate.render({ + project: project, + session: session, + }); + } + + /** + * Parse the project from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).project; + } + + /** + * Parse the session from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).session; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.sessionEntityTypesStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/session_entity_types_client_config.json b/owl-bot-staging/v2/src/v2/session_entity_types_client_config.json new file mode 100644 index 00000000..52a412a1 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/session_entity_types_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.SessionEntityTypes": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListSessionEntityTypes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetSessionEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateSessionEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateSessionEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteSessionEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/session_entity_types_proto_list.json b/owl-bot-staging/v2/src/v2/session_entity_types_proto_list.json new file mode 100644 index 00000000..d2ecb25e --- /dev/null +++ b/owl-bot-staging/v2/src/v2/session_entity_types_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/owl-bot-staging/v2/src/v2/sessions_client.ts b/owl-bot-staging/v2/src/v2/sessions_client.ts new file mode 100644 index 00000000..b27b0d9d --- /dev/null +++ b/owl-bot-staging/v2/src/v2/sessions_client.ts @@ -0,0 +1,2476 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/sessions_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sessions_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * A service used for session interactions. + * + * For more information, see the [API interactions + * guide](https://cloud.google.com/dialogflow/docs/api-overview). + * @class + * @memberof v2 + */ +export class SessionsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + sessionsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SessionsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SessionsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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. + // Provide descriptors for these. + this.descriptors.stream = { + streamingDetectIntent: new this._gaxModule.StreamDescriptor(gax.StreamType.BIDI_STREAMING) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.Sessions', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sessionsStub) { + return this.sessionsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.Sessions. + this.sessionsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.Sessions') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.Sessions, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sessionsStubMethods = + ['detectIntent', 'streamingDetectIntent']; + for (const methodName of sessionsStubMethods) { + const callPromise = this.sessionsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.stream[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sessionsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + detectIntent( + request?: protos.google.cloud.dialogflow.v2.IDetectIntentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IDetectIntentResponse, + protos.google.cloud.dialogflow.v2.IDetectIntentRequest|undefined, {}|undefined + ]>; + detectIntent( + request: protos.google.cloud.dialogflow.v2.IDetectIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IDetectIntentResponse, + protos.google.cloud.dialogflow.v2.IDetectIntentRequest|null|undefined, + {}|null|undefined>): void; + detectIntent( + request: protos.google.cloud.dialogflow.v2.IDetectIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IDetectIntentResponse, + protos.google.cloud.dialogflow.v2.IDetectIntentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Processes a natural language query and returns structured, actionable data + * as a result. This method is not idempotent, because it may cause contexts + * and session entity types to be updated, which in turn might affect + * results of future queries. + * + * 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 + * Required. The name of the session this query is sent to. Format: + * `projects//agent/sessions/`, or + * `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume + * default 'draft' environment (`Environment ID` might be referred to as + * environment name at some places). If `User ID` is not specified, we are + * using "-". It's up to the API caller to choose an appropriate `Session ID` + * and `User Id`. They can be a random number or some type of user and session + * identifiers (preferably hashed). 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.v2.QueryParameters} request.queryParams + * The parameters of this query. + * @param {google.cloud.dialogflow.v2.QueryInput} request.queryInput + * Required. The input specification. It can be set to: + * + * 1. an audio config + * which instructs the speech recognizer how to process the speech audio, + * + * 2. a conversational query in the form of text, or + * + * 3. an event that specifies which intent to trigger. + * @param {google.cloud.dialogflow.v2.OutputAudioConfig} request.outputAudioConfig + * Instructs the speech synthesizer how to generate the output + * audio. If this field is not set and agent-level speech synthesizer is not + * configured, no output audio is generated. + * @param {google.protobuf.FieldMask} request.outputAudioConfigMask + * Mask for {@link google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config|output_audio_config} indicating which settings in this + * request-level config should override speech synthesizer settings defined at + * agent-level. + * + * If unspecified or empty, {@link google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config|output_audio_config} replaces the agent-level + * config in its entirety. + * @param {Buffer} request.inputAudio + * The natural language speech audio to be processed. This field + * should be populated iff `query_input` is set to an input audio config. + * A single request can contain up to 1 minute of speech audio data. + * @param {object} [options] + * 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. + * The first element of the array is an object representing [DetectIntentResponse]{@link google.cloud.dialogflow.v2.DetectIntentResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.detectIntent(request); + */ + detectIntent( + request?: protos.google.cloud.dialogflow.v2.IDetectIntentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IDetectIntentResponse, + protos.google.cloud.dialogflow.v2.IDetectIntentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IDetectIntentResponse, + protos.google.cloud.dialogflow.v2.IDetectIntentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IDetectIntentResponse, + protos.google.cloud.dialogflow.v2.IDetectIntentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'session': request.session || '', + }); + this.initialize(); + return this.innerApiCalls.detectIntent(request, options, callback); + } + +/** + * Processes a natural language query in audio format in a streaming fashion + * and returns structured, actionable data as a result. This method is only + * available via the gRPC API (not REST). + * + * 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} + * An object stream which is both readable and writable. It accepts objects + * representing [StreamingDetectIntentRequest]{@link google.cloud.dialogflow.v2.StreamingDetectIntentRequest} for write() method, and + * will emit objects representing [StreamingDetectIntentResponse]{@link google.cloud.dialogflow.v2.StreamingDetectIntentResponse} on 'data' event asynchronously. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming) + * for more details and examples. + * @example + * const stream = client.streamingDetectIntent(); + * stream.on('data', (response) => { ... }); + * stream.on('end', () => { ... }); + * stream.write(request); + * stream.end(); + */ + streamingDetectIntent( + options?: CallOptions): + gax.CancellableStream { + this.initialize(); + return this.innerApiCalls.streamingDetectIntent(options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSession resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionPath(project:string,environment:string,user:string,session:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSession resource. + * + * @param {string} projectAgentEnvironmentUserSessionName + * A fully-qualified path representing project_agent_environment_user_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionName(projectAgentEnvironmentUserSessionName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match(projectAgentEnvironmentUserSessionName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSession resource. + * + * @param {string} projectAgentEnvironmentUserSessionName + * A fully-qualified path representing project_agent_environment_user_session resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionName(projectAgentEnvironmentUserSessionName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match(projectAgentEnvironmentUserSessionName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSession resource. + * + * @param {string} projectAgentEnvironmentUserSessionName + * A fully-qualified path representing project_agent_environment_user_session resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionName(projectAgentEnvironmentUserSessionName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match(projectAgentEnvironmentUserSessionName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSession resource. + * + * @param {string} projectAgentEnvironmentUserSessionName + * A fully-qualified path representing project_agent_environment_user_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionName(projectAgentEnvironmentUserSessionName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match(projectAgentEnvironmentUserSessionName).session; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSession resource name string. + * + * @param {string} project + * @param {string} session + * @returns {string} Resource name string. + */ + projectAgentSessionPath(project:string,session:string) { + return this.pathTemplates.projectAgentSessionPathTemplate.render({ + project: project, + session: session, + }); + } + + /** + * Parse the project from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).project; + } + + /** + * Parse the session from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).session; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSession resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionPath(project:string,location:string,environment:string,user:string,session:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSession resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionName + * A fully-qualified path representing project_location_agent_environment_user_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionName(projectLocationAgentEnvironmentUserSessionName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match(projectLocationAgentEnvironmentUserSessionName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSession resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionName + * A fully-qualified path representing project_location_agent_environment_user_session resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionName(projectLocationAgentEnvironmentUserSessionName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match(projectLocationAgentEnvironmentUserSessionName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSession resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionName + * A fully-qualified path representing project_location_agent_environment_user_session resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionName(projectLocationAgentEnvironmentUserSessionName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match(projectLocationAgentEnvironmentUserSessionName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSession resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionName + * A fully-qualified path representing project_location_agent_environment_user_session resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionName(projectLocationAgentEnvironmentUserSessionName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match(projectLocationAgentEnvironmentUserSessionName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSession resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionName + * A fully-qualified path representing project_location_agent_environment_user_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionName(projectLocationAgentEnvironmentUserSessionName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match(projectLocationAgentEnvironmentUserSessionName).session; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSession resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @returns {string} Resource name string. + */ + projectLocationAgentSessionPath(project:string,location:string,session:string) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.render({ + project: project, + location: location, + session: session, + }); + } + + /** + * Parse the project from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionName(projectLocationAgentSessionName: string) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match(projectLocationAgentSessionName).project; + } + + /** + * Parse the location from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionName(projectLocationAgentSessionName: string) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match(projectLocationAgentSessionName).location; + } + + /** + * Parse the session from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionName(projectLocationAgentSessionName: string) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match(projectLocationAgentSessionName).session; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.sessionsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/sessions_client_config.json b/owl-bot-staging/v2/src/v2/sessions_client_config.json new file mode 100644 index 00000000..b9c1b92d --- /dev/null +++ b/owl-bot-staging/v2/src/v2/sessions_client_config.json @@ -0,0 +1,39 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.Sessions": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "DetectIntent": { + "timeout_millis": 220000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "StreamingDetectIntent": { + "timeout_millis": 220000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/sessions_proto_list.json b/owl-bot-staging/v2/src/v2/sessions_proto_list.json new file mode 100644 index 00000000..d2ecb25e --- /dev/null +++ b/owl-bot-staging/v2/src/v2/sessions_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/owl-bot-staging/v2/src/v2/versions_client.ts b/owl-bot-staging/v2/src/v2/versions_client.ts new file mode 100644 index 00000000..7a2459e2 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/versions_client.ts @@ -0,0 +1,2620 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/versions_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './versions_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.Version|Versions}. + * @class + * @memberof v2 + */ +export class VersionsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + versionsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of VersionsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof VersionsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listVersions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'versions') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.Versions', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.versionsStub) { + return this.versionsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.Versions. + this.versionsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.Versions') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.Versions, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const versionsStubMethods = + ['listVersions', 'getVersion', 'createVersion', 'updateVersion', 'deleteVersion']; + for (const methodName of versionsStubMethods) { + const callPromise = this.versionsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.versionsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getVersion( + request?: protos.google.cloud.dialogflow.v2.IGetVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.IGetVersionRequest|undefined, {}|undefined + ]>; + getVersion( + request: protos.google.cloud.dialogflow.v2.IGetVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.IGetVersionRequest|null|undefined, + {}|null|undefined>): void; + getVersion( + request: protos.google.cloud.dialogflow.v2.IGetVersionRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.IGetVersionRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified agent version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the version. + * Supported formats: + * + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + * @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. + * The first element of the array is an object representing [Version]{@link google.cloud.dialogflow.v2.Version}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getVersion(request); + */ + getVersion( + request?: protos.google.cloud.dialogflow.v2.IGetVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.IGetVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.IGetVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.IGetVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getVersion(request, options, callback); + } + createVersion( + request?: protos.google.cloud.dialogflow.v2.ICreateVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.ICreateVersionRequest|undefined, {}|undefined + ]>; + createVersion( + request: protos.google.cloud.dialogflow.v2.ICreateVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.ICreateVersionRequest|null|undefined, + {}|null|undefined>): void; + createVersion( + request: protos.google.cloud.dialogflow.v2.ICreateVersionRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.ICreateVersionRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates an agent version. + * + * The new version points to the agent instance in the "default" environment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to create a version for. + * Supported formats: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {google.cloud.dialogflow.v2.Version} request.version + * Required. The version to create. + * @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. + * The first element of the array is an object representing [Version]{@link google.cloud.dialogflow.v2.Version}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createVersion(request); + */ + createVersion( + request?: protos.google.cloud.dialogflow.v2.ICreateVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.ICreateVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.ICreateVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.ICreateVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createVersion(request, options, callback); + } + updateVersion( + request?: protos.google.cloud.dialogflow.v2.IUpdateVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.IUpdateVersionRequest|undefined, {}|undefined + ]>; + updateVersion( + request: protos.google.cloud.dialogflow.v2.IUpdateVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.IUpdateVersionRequest|null|undefined, + {}|null|undefined>): void; + updateVersion( + request: protos.google.cloud.dialogflow.v2.IUpdateVersionRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.IUpdateVersionRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified agent version. + * + * Note that this method does not allow you to update the state of the agent + * the given version points to. It allows you to update only mutable + * properties of the version resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.Version} request.version + * Required. The version to update. + * Supported formats: + * + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields get updated. + * @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. + * The first element of the array is an object representing [Version]{@link google.cloud.dialogflow.v2.Version}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateVersion(request); + */ + updateVersion( + request?: protos.google.cloud.dialogflow.v2.IUpdateVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.IUpdateVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.IUpdateVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.IUpdateVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'version.name': request.version!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateVersion(request, options, callback); + } + deleteVersion( + request?: protos.google.cloud.dialogflow.v2.IDeleteVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteVersionRequest|undefined, {}|undefined + ]>; + deleteVersion( + request: protos.google.cloud.dialogflow.v2.IDeleteVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteVersionRequest|null|undefined, + {}|null|undefined>): void; + deleteVersion( + request: protos.google.cloud.dialogflow.v2.IDeleteVersionRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteVersionRequest|null|undefined, + {}|null|undefined>): void; +/** + * Delete the specified agent version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the version to delete. + * Supported formats: + * + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteVersion(request); + */ + deleteVersion( + request?: protos.google.cloud.dialogflow.v2.IDeleteVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteVersion(request, options, callback); + } + + listVersions( + request?: protos.google.cloud.dialogflow.v2.IListVersionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IVersion[], + protos.google.cloud.dialogflow.v2.IListVersionsRequest|null, + protos.google.cloud.dialogflow.v2.IListVersionsResponse + ]>; + listVersions( + request: protos.google.cloud.dialogflow.v2.IListVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListVersionsRequest, + protos.google.cloud.dialogflow.v2.IListVersionsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IVersion>): void; + listVersions( + request: protos.google.cloud.dialogflow.v2.IListVersionsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListVersionsRequest, + protos.google.cloud.dialogflow.v2.IListVersionsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IVersion>): void; +/** + * Returns the list of all versions of the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all versions from. + * Supported formats: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [Version]{@link google.cloud.dialogflow.v2.Version}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listVersionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listVersions( + request?: protos.google.cloud.dialogflow.v2.IListVersionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2.IListVersionsRequest, + protos.google.cloud.dialogflow.v2.IListVersionsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IVersion>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListVersionsRequest, + protos.google.cloud.dialogflow.v2.IListVersionsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IVersion>): + Promise<[ + protos.google.cloud.dialogflow.v2.IVersion[], + protos.google.cloud.dialogflow.v2.IListVersionsRequest|null, + protos.google.cloud.dialogflow.v2.IListVersionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listVersions(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all versions from. + * Supported formats: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Version]{@link google.cloud.dialogflow.v2.Version} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listVersionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listVersionsStream( + request?: protos.google.cloud.dialogflow.v2.IListVersionsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listVersions.createStream( + this.innerApiCalls.listVersions as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listVersions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all versions from. + * Supported formats: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Version]{@link google.cloud.dialogflow.v2.Version}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listVersionsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listVersionsAsync( + request?: protos.google.cloud.dialogflow.v2.IListVersionsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listVersions.asyncIterate( + this.innerApiCalls['listVersions'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.versionsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/versions_client_config.json b/owl-bot-staging/v2/src/v2/versions_client_config.json new file mode 100644 index 00000000..db17e434 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/versions_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.Versions": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListVersions": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/versions_proto_list.json b/owl-bot-staging/v2/src/v2/versions_proto_list.json new file mode 100644 index 00000000..d2ecb25e --- /dev/null +++ b/owl-bot-staging/v2/src/v2/versions_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000..85cdb2d0 --- /dev/null +++ b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js @@ -0,0 +1,41 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const dialogflow = require('@google-cloud/dialogflow'); + +function main() { + const agentsClient = new dialogflow.AgentsClient(); + const answerRecordsClient = new dialogflow.AnswerRecordsClient(); + const contextsClient = new dialogflow.ContextsClient(); + const conversationProfilesClient = new dialogflow.ConversationProfilesClient(); + const conversationsClient = new dialogflow.ConversationsClient(); + const documentsClient = new dialogflow.DocumentsClient(); + const entityTypesClient = new dialogflow.EntityTypesClient(); + const environmentsClient = new dialogflow.EnvironmentsClient(); + const fulfillmentsClient = new dialogflow.FulfillmentsClient(); + const intentsClient = new dialogflow.IntentsClient(); + const knowledgeBasesClient = new dialogflow.KnowledgeBasesClient(); + const participantsClient = new dialogflow.ParticipantsClient(); + const sessionEntityTypesClient = new dialogflow.SessionEntityTypesClient(); + const sessionsClient = new dialogflow.SessionsClient(); + const versionsClient = new dialogflow.VersionsClient(); +} + +main(); diff --git a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000..5a454ee2 --- /dev/null +++ b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,116 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {AgentsClient, AnswerRecordsClient, ContextsClient, ConversationProfilesClient, ConversationsClient, DocumentsClient, EntityTypesClient, EnvironmentsClient, FulfillmentsClient, IntentsClient, KnowledgeBasesClient, ParticipantsClient, SessionEntityTypesClient, SessionsClient, VersionsClient} from '@google-cloud/dialogflow'; + +// check that the client class type name can be used +function doStuffWithAgentsClient(client: AgentsClient) { + client.close(); +} +function doStuffWithAnswerRecordsClient(client: AnswerRecordsClient) { + client.close(); +} +function doStuffWithContextsClient(client: ContextsClient) { + client.close(); +} +function doStuffWithConversationProfilesClient(client: ConversationProfilesClient) { + client.close(); +} +function doStuffWithConversationsClient(client: ConversationsClient) { + client.close(); +} +function doStuffWithDocumentsClient(client: DocumentsClient) { + client.close(); +} +function doStuffWithEntityTypesClient(client: EntityTypesClient) { + client.close(); +} +function doStuffWithEnvironmentsClient(client: EnvironmentsClient) { + client.close(); +} +function doStuffWithFulfillmentsClient(client: FulfillmentsClient) { + client.close(); +} +function doStuffWithIntentsClient(client: IntentsClient) { + client.close(); +} +function doStuffWithKnowledgeBasesClient(client: KnowledgeBasesClient) { + client.close(); +} +function doStuffWithParticipantsClient(client: ParticipantsClient) { + client.close(); +} +function doStuffWithSessionEntityTypesClient(client: SessionEntityTypesClient) { + client.close(); +} +function doStuffWithSessionsClient(client: SessionsClient) { + client.close(); +} +function doStuffWithVersionsClient(client: VersionsClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const agentsClient = new AgentsClient(); + doStuffWithAgentsClient(agentsClient); + // check that the client instance can be created + const answerRecordsClient = new AnswerRecordsClient(); + doStuffWithAnswerRecordsClient(answerRecordsClient); + // check that the client instance can be created + const contextsClient = new ContextsClient(); + doStuffWithContextsClient(contextsClient); + // check that the client instance can be created + const conversationProfilesClient = new ConversationProfilesClient(); + doStuffWithConversationProfilesClient(conversationProfilesClient); + // check that the client instance can be created + const conversationsClient = new ConversationsClient(); + doStuffWithConversationsClient(conversationsClient); + // check that the client instance can be created + const documentsClient = new DocumentsClient(); + doStuffWithDocumentsClient(documentsClient); + // check that the client instance can be created + const entityTypesClient = new EntityTypesClient(); + doStuffWithEntityTypesClient(entityTypesClient); + // check that the client instance can be created + const environmentsClient = new EnvironmentsClient(); + doStuffWithEnvironmentsClient(environmentsClient); + // check that the client instance can be created + const fulfillmentsClient = new FulfillmentsClient(); + doStuffWithFulfillmentsClient(fulfillmentsClient); + // check that the client instance can be created + const intentsClient = new IntentsClient(); + doStuffWithIntentsClient(intentsClient); + // check that the client instance can be created + const knowledgeBasesClient = new KnowledgeBasesClient(); + doStuffWithKnowledgeBasesClient(knowledgeBasesClient); + // check that the client instance can be created + const participantsClient = new ParticipantsClient(); + doStuffWithParticipantsClient(participantsClient); + // check that the client instance can be created + const sessionEntityTypesClient = new SessionEntityTypesClient(); + doStuffWithSessionEntityTypesClient(sessionEntityTypesClient); + // check that the client instance can be created + const sessionsClient = new SessionsClient(); + doStuffWithSessionsClient(sessionsClient); + // check that the client instance can be created + const versionsClient = new VersionsClient(); + doStuffWithVersionsClient(versionsClient); +} + +main(); diff --git a/owl-bot-staging/v2/system-test/install.ts b/owl-bot-staging/v2/system-test/install.ts new file mode 100644 index 00000000..1f850b52 --- /dev/null +++ b/owl-bot-staging/v2/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v2/test/gapic_agents_v2.ts b/owl-bot-staging/v2/test/gapic_agents_v2.ts new file mode 100644 index 00000000..de3be84d --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_agents_v2.ts @@ -0,0 +1,2926 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as agentsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.AgentsClient', () => { + it('has servicePath', () => { + const servicePath = agentsModule.v2.AgentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = agentsModule.v2.AgentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = agentsModule.v2.AgentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new agentsModule.v2.AgentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new agentsModule.v2.AgentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.agentsStub, undefined); + await client.initialize(); + assert(client.agentsStub); + }); + + it('has close method', () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getAgent', () => { + it('invokes getAgent without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()); + client.innerApiCalls.getAgent = stubSimpleCall(expectedResponse); + const [response] = await client.getAgent(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getAgent without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()); + client.innerApiCalls.getAgent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAgent( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IAgent|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getAgent with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getAgent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAgent(request), expectedError); + assert((client.innerApiCalls.getAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('setAgent', () => { + it('invokes setAgent without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SetAgentRequest()); + request.agent = {}; + request.agent.parent = ''; + const expectedHeaderRequestParams = "agent.parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()); + client.innerApiCalls.setAgent = stubSimpleCall(expectedResponse); + const [response] = await client.setAgent(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setAgent without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SetAgentRequest()); + request.agent = {}; + request.agent.parent = ''; + const expectedHeaderRequestParams = "agent.parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()); + client.innerApiCalls.setAgent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setAgent( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IAgent|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes setAgent with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SetAgentRequest()); + request.agent = {}; + request.agent.parent = ''; + const expectedHeaderRequestParams = "agent.parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setAgent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setAgent(request), expectedError); + assert((client.innerApiCalls.setAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteAgent', () => { + it('invokes deleteAgent without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteAgent = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAgent(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteAgent without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteAgent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAgent( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteAgent with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAgent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteAgent(request), expectedError); + assert((client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getValidationResult', () => { + it('invokes getValidationResult without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetValidationResultRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ValidationResult()); + client.innerApiCalls.getValidationResult = stubSimpleCall(expectedResponse); + const [response] = await client.getValidationResult(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getValidationResult as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getValidationResult without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetValidationResultRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ValidationResult()); + client.innerApiCalls.getValidationResult = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getValidationResult( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IValidationResult|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getValidationResult as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getValidationResult with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetValidationResultRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getValidationResult = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getValidationResult(request), expectedError); + assert((client.innerApiCalls.getValidationResult as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('trainAgent', () => { + it('invokes trainAgent without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.TrainAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.trainAgent = stubLongRunningCall(expectedResponse); + const [operation] = await client.trainAgent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes trainAgent without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.TrainAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.trainAgent = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.trainAgent( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes trainAgent with call error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.TrainAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.trainAgent = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.trainAgent(request), expectedError); + assert((client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes trainAgent with LRO error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.TrainAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.trainAgent = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.trainAgent(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkTrainAgentProgress without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkTrainAgentProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkTrainAgentProgress with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkTrainAgentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('exportAgent', () => { + it('invokes exportAgent without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ExportAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.exportAgent = stubLongRunningCall(expectedResponse); + const [operation] = await client.exportAgent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes exportAgent without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ExportAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.exportAgent = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.exportAgent( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes exportAgent with call error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ExportAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.exportAgent = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.exportAgent(request), expectedError); + assert((client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes exportAgent with LRO error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ExportAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.exportAgent = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.exportAgent(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkExportAgentProgress without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkExportAgentProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkExportAgentProgress with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkExportAgentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('importAgent', () => { + it('invokes importAgent without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ImportAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.importAgent = stubLongRunningCall(expectedResponse); + const [operation] = await client.importAgent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.importAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes importAgent without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ImportAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.importAgent = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importAgent( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.importAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes importAgent with call error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ImportAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importAgent = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.importAgent(request), expectedError); + assert((client.innerApiCalls.importAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes importAgent with LRO error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ImportAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importAgent = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.importAgent(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.importAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkImportAgentProgress without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkImportAgentProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportAgentProgress with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkImportAgentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('restoreAgent', () => { + it('invokes restoreAgent without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.RestoreAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.restoreAgent = stubLongRunningCall(expectedResponse); + const [operation] = await client.restoreAgent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes restoreAgent without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.RestoreAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.restoreAgent = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreAgent( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes restoreAgent with call error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.RestoreAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreAgent = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.restoreAgent(request), expectedError); + assert((client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes restoreAgent with LRO error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.RestoreAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreAgent = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.restoreAgent(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkRestoreAgentProgress without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRestoreAgentProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRestoreAgentProgress with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRestoreAgentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('searchAgents', () => { + it('invokes searchAgents without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SearchAgentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + ]; + client.innerApiCalls.searchAgents = stubSimpleCall(expectedResponse); + const [response] = await client.searchAgents(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.searchAgents as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes searchAgents without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SearchAgentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + ]; + client.innerApiCalls.searchAgents = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchAgents( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IAgent[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.searchAgents as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes searchAgents with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SearchAgentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.searchAgents = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchAgents(request), expectedError); + assert((client.innerApiCalls.searchAgents as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes searchAgentsStream without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SearchAgentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + ]; + client.descriptors.page.searchAgents.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.searchAgentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Agent[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.Agent) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.searchAgents.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.searchAgents, request)); + assert.strictEqual( + (client.descriptors.page.searchAgents.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes searchAgentsStream with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SearchAgentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.searchAgents.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.searchAgentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Agent[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.Agent) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.searchAgents.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.searchAgents, request)); + assert.strictEqual( + (client.descriptors.page.searchAgents.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with searchAgents without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SearchAgentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + ]; + client.descriptors.page.searchAgents.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IAgent[] = []; + const iterable = client.searchAgentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.searchAgents.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.searchAgents.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with searchAgents with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SearchAgentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.searchAgents.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.searchAgentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IAgent[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.searchAgents.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.searchAgents.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new agentsModule.v2.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.v2.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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new agentsModule.v2.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.v2.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/owl-bot-staging/v2/test/gapic_answer_records_v2.ts b/owl-bot-staging/v2/test/gapic_answer_records_v2.ts new file mode 100644 index 00000000..f290d68c --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_answer_records_v2.ts @@ -0,0 +1,2082 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as answerrecordsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.AnswerRecordsClient', () => { + it('has servicePath', () => { + const servicePath = answerrecordsModule.v2.AnswerRecordsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = answerrecordsModule.v2.AnswerRecordsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = answerrecordsModule.v2.AnswerRecordsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.answerRecordsStub, undefined); + await client.initialize(); + assert(client.answerRecordsStub); + }); + + it('has close method', () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('updateAnswerRecord', () => { + it('invokes updateAnswerRecord without error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest()); + request.answerRecord = {}; + request.answerRecord.name = ''; + const expectedHeaderRequestParams = "answer_record.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()); + client.innerApiCalls.updateAnswerRecord = stubSimpleCall(expectedResponse); + const [response] = await client.updateAnswerRecord(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateAnswerRecord as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateAnswerRecord without error using callback', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest()); + request.answerRecord = {}; + request.answerRecord.name = ''; + const expectedHeaderRequestParams = "answer_record.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()); + client.innerApiCalls.updateAnswerRecord = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAnswerRecord( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IAnswerRecord|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateAnswerRecord as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateAnswerRecord with error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest()); + request.answerRecord = {}; + request.answerRecord.name = ''; + const expectedHeaderRequestParams = "answer_record.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAnswerRecord = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateAnswerRecord(request), expectedError); + assert((client.innerApiCalls.updateAnswerRecord as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listAnswerRecords', () => { + it('invokes listAnswerRecords without error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), + ]; + client.innerApiCalls.listAnswerRecords = stubSimpleCall(expectedResponse); + const [response] = await client.listAnswerRecords(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAnswerRecords as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAnswerRecords without error using callback', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), + ]; + client.innerApiCalls.listAnswerRecords = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAnswerRecords( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IAnswerRecord[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAnswerRecords as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listAnswerRecords with error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listAnswerRecords = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAnswerRecords(request), expectedError); + assert((client.innerApiCalls.listAnswerRecords as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAnswerRecordsStream without error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), + ]; + client.descriptors.page.listAnswerRecords.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAnswerRecordsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.AnswerRecord[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.AnswerRecord) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listAnswerRecords.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAnswerRecords, request)); + assert.strictEqual( + (client.descriptors.page.listAnswerRecords.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listAnswerRecordsStream with error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listAnswerRecords.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAnswerRecordsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.AnswerRecord[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.AnswerRecord) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAnswerRecords.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAnswerRecords, request)); + assert.strictEqual( + (client.descriptors.page.listAnswerRecords.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAnswerRecords without error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), + ]; + client.descriptors.page.listAnswerRecords.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IAnswerRecord[] = []; + const iterable = client.listAnswerRecordsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAnswerRecords with error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listAnswerRecords.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAnswerRecordsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IAnswerRecord[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + 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 answerrecordsModule.v2.AnswerRecordsClient({ + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + 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 answerrecordsModule.v2.AnswerRecordsClient({ + 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/owl-bot-staging/v2/test/gapic_contexts_v2.ts b/owl-bot-staging/v2/test/gapic_contexts_v2.ts new file mode 100644 index 00000000..fbe35adc --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_contexts_v2.ts @@ -0,0 +1,2456 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as contextsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.ContextsClient', () => { + it('has servicePath', () => { + const servicePath = contextsModule.v2.ContextsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = contextsModule.v2.ContextsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = contextsModule.v2.ContextsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new contextsModule.v2.ContextsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new contextsModule.v2.ContextsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.contextsStub, undefined); + await client.initialize(); + assert(client.contextsStub); + }); + + it('has close method', () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getContext', () => { + it('invokes getContext without error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetContextRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()); + client.innerApiCalls.getContext = stubSimpleCall(expectedResponse); + const [response] = await client.getContext(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getContext without error using callback', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetContextRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()); + client.innerApiCalls.getContext = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getContext( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IContext|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getContext with error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetContextRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getContext = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getContext(request), expectedError); + assert((client.innerApiCalls.getContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createContext', () => { + it('invokes createContext without error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateContextRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()); + client.innerApiCalls.createContext = stubSimpleCall(expectedResponse); + const [response] = await client.createContext(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createContext without error using callback', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateContextRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()); + client.innerApiCalls.createContext = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createContext( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IContext|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createContext with error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateContextRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createContext = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createContext(request), expectedError); + assert((client.innerApiCalls.createContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateContext', () => { + it('invokes updateContext without error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateContextRequest()); + request.context = {}; + request.context.name = ''; + const expectedHeaderRequestParams = "context.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()); + client.innerApiCalls.updateContext = stubSimpleCall(expectedResponse); + const [response] = await client.updateContext(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateContext without error using callback', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateContextRequest()); + request.context = {}; + request.context.name = ''; + const expectedHeaderRequestParams = "context.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()); + client.innerApiCalls.updateContext = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateContext( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IContext|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateContext with error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateContextRequest()); + request.context = {}; + request.context.name = ''; + const expectedHeaderRequestParams = "context.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateContext = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateContext(request), expectedError); + assert((client.innerApiCalls.updateContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteContext', () => { + it('invokes deleteContext without error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteContextRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteContext = stubSimpleCall(expectedResponse); + const [response] = await client.deleteContext(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteContext without error using callback', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteContextRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteContext = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteContext( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteContext with error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteContextRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteContext = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteContext(request), expectedError); + assert((client.innerApiCalls.deleteContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteAllContexts', () => { + it('invokes deleteAllContexts without error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteAllContextsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteAllContexts = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAllContexts(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteAllContexts as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteAllContexts without error using callback', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteAllContextsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteAllContexts = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAllContexts( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteAllContexts as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteAllContexts with error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteAllContextsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAllContexts = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteAllContexts(request), expectedError); + assert((client.innerApiCalls.deleteAllContexts as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listContexts', () => { + it('invokes listContexts without error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListContextsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + ]; + client.innerApiCalls.listContexts = stubSimpleCall(expectedResponse); + const [response] = await client.listContexts(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listContexts as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listContexts without error using callback', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListContextsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + ]; + client.innerApiCalls.listContexts = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listContexts( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IContext[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listContexts as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listContexts with error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListContextsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listContexts = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listContexts(request), expectedError); + assert((client.innerApiCalls.listContexts as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listContextsStream without error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListContextsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + ]; + client.descriptors.page.listContexts.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listContextsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Context[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.Context) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listContexts.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listContexts, request)); + assert.strictEqual( + (client.descriptors.page.listContexts.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listContextsStream with error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListContextsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listContexts.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listContextsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Context[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.Context) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listContexts.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listContexts, request)); + assert.strictEqual( + (client.descriptors.page.listContexts.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listContexts without error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListContextsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + ]; + client.descriptors.page.listContexts.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IContext[] = []; + const iterable = client.listContextsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listContexts.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listContexts.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listContexts with error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListContextsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listContexts.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listContextsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IContext[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listContexts.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listContexts.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSession', () => { + const fakePath = "/rendered/path/projectAgentSession"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionPath', () => { + const result = client.projectAgentSessionPath("projectValue", "sessionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionName', () => { + const result = client.matchProjectFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionName', () => { + const result = client.matchSessionFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new contextsModule.v2.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.v2.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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new contextsModule.v2.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.v2.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/owl-bot-staging/v2/test/gapic_conversation_profiles_v2.ts b/owl-bot-staging/v2/test/gapic_conversation_profiles_v2.ts new file mode 100644 index 00000000..0cc15558 --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_conversation_profiles_v2.ts @@ -0,0 +1,2334 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as conversationprofilesModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.ConversationProfilesClient', () => { + it('has servicePath', () => { + const servicePath = conversationprofilesModule.v2.ConversationProfilesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = conversationprofilesModule.v2.ConversationProfilesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = conversationprofilesModule.v2.ConversationProfilesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationProfilesStub, undefined); + await client.initialize(); + assert(client.conversationProfilesStub); + }); + + it('has close method', () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getConversationProfile', () => { + it('invokes getConversationProfile without error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetConversationProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()); + client.innerApiCalls.getConversationProfile = stubSimpleCall(expectedResponse); + const [response] = await client.getConversationProfile(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getConversationProfile without error using callback', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetConversationProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()); + client.innerApiCalls.getConversationProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConversationProfile( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversationProfile|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getConversationProfile with error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetConversationProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getConversationProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getConversationProfile(request), expectedError); + assert((client.innerApiCalls.getConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createConversationProfile', () => { + it('invokes createConversationProfile without error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateConversationProfileRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()); + client.innerApiCalls.createConversationProfile = stubSimpleCall(expectedResponse); + const [response] = await client.createConversationProfile(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createConversationProfile without error using callback', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateConversationProfileRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()); + client.innerApiCalls.createConversationProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConversationProfile( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversationProfile|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createConversationProfile with error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateConversationProfileRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversationProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createConversationProfile(request), expectedError); + assert((client.innerApiCalls.createConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateConversationProfile', () => { + it('invokes updateConversationProfile without error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateConversationProfileRequest()); + request.conversationProfile = {}; + request.conversationProfile.name = ''; + const expectedHeaderRequestParams = "conversation_profile.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()); + client.innerApiCalls.updateConversationProfile = stubSimpleCall(expectedResponse); + const [response] = await client.updateConversationProfile(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateConversationProfile without error using callback', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateConversationProfileRequest()); + request.conversationProfile = {}; + request.conversationProfile.name = ''; + const expectedHeaderRequestParams = "conversation_profile.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()); + client.innerApiCalls.updateConversationProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateConversationProfile( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversationProfile|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateConversationProfile with error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateConversationProfileRequest()); + request.conversationProfile = {}; + request.conversationProfile.name = ''; + const expectedHeaderRequestParams = "conversation_profile.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateConversationProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateConversationProfile(request), expectedError); + assert((client.innerApiCalls.updateConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteConversationProfile', () => { + it('invokes deleteConversationProfile without error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteConversationProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteConversationProfile = stubSimpleCall(expectedResponse); + const [response] = await client.deleteConversationProfile(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteConversationProfile without error using callback', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteConversationProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteConversationProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteConversationProfile( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteConversationProfile with error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteConversationProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConversationProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteConversationProfile(request), expectedError); + assert((client.innerApiCalls.deleteConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listConversationProfiles', () => { + it('invokes listConversationProfiles without error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), + ]; + client.innerApiCalls.listConversationProfiles = stubSimpleCall(expectedResponse); + const [response] = await client.listConversationProfiles(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listConversationProfiles as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listConversationProfiles without error using callback', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), + ]; + client.innerApiCalls.listConversationProfiles = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConversationProfiles( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversationProfile[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listConversationProfiles as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listConversationProfiles with error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listConversationProfiles = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listConversationProfiles(request), expectedError); + assert((client.innerApiCalls.listConversationProfiles as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listConversationProfilesStream without error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), + ]; + client.descriptors.page.listConversationProfiles.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listConversationProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.ConversationProfile[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.ConversationProfile) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listConversationProfiles.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConversationProfiles, request)); + assert.strictEqual( + (client.descriptors.page.listConversationProfiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listConversationProfilesStream with error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listConversationProfiles.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listConversationProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.ConversationProfile[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.ConversationProfile) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listConversationProfiles.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConversationProfiles, request)); + assert.strictEqual( + (client.descriptors.page.listConversationProfiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listConversationProfiles without error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), + ]; + client.descriptors.page.listConversationProfiles.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IConversationProfile[] = []; + const iterable = client.listConversationProfilesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listConversationProfiles with error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listConversationProfiles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConversationProfilesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IConversationProfile[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + 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 conversationprofilesModule.v2.ConversationProfilesClient({ + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + 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 conversationprofilesModule.v2.ConversationProfilesClient({ + 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/owl-bot-staging/v2/test/gapic_conversations_v2.ts b/owl-bot-staging/v2/test/gapic_conversations_v2.ts new file mode 100644 index 00000000..ff71baa2 --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_conversations_v2.ts @@ -0,0 +1,2470 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as conversationsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.ConversationsClient', () => { + it('has servicePath', () => { + const servicePath = conversationsModule.v2.ConversationsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = conversationsModule.v2.ConversationsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = conversationsModule.v2.ConversationsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new conversationsModule.v2.ConversationsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new conversationsModule.v2.ConversationsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationsStub, undefined); + await client.initialize(); + assert(client.conversationsStub); + }); + + it('has close method', () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createConversation', () => { + it('invokes createConversation without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateConversationRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()); + client.innerApiCalls.createConversation = stubSimpleCall(expectedResponse); + const [response] = await client.createConversation(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createConversation without error using callback', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateConversationRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()); + client.innerApiCalls.createConversation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConversation( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createConversation with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateConversationRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createConversation(request), expectedError); + assert((client.innerApiCalls.createConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getConversation', () => { + it('invokes getConversation without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetConversationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()); + client.innerApiCalls.getConversation = stubSimpleCall(expectedResponse); + const [response] = await client.getConversation(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getConversation without error using callback', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetConversationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()); + client.innerApiCalls.getConversation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConversation( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getConversation with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetConversationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getConversation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getConversation(request), expectedError); + assert((client.innerApiCalls.getConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('completeConversation', () => { + it('invokes completeConversation without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CompleteConversationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()); + client.innerApiCalls.completeConversation = stubSimpleCall(expectedResponse); + const [response] = await client.completeConversation(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.completeConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes completeConversation without error using callback', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CompleteConversationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()); + client.innerApiCalls.completeConversation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.completeConversation( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.completeConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes completeConversation with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CompleteConversationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.completeConversation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.completeConversation(request), expectedError); + assert((client.innerApiCalls.completeConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listConversations', () => { + it('invokes listConversations without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), + ]; + client.innerApiCalls.listConversations = stubSimpleCall(expectedResponse); + const [response] = await client.listConversations(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listConversations as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listConversations without error using callback', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), + ]; + client.innerApiCalls.listConversations = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConversations( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversation[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listConversations as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listConversations with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listConversations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listConversations(request), expectedError); + assert((client.innerApiCalls.listConversations as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listConversationsStream without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), + ]; + client.descriptors.page.listConversations.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listConversationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Conversation[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.Conversation) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listConversations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConversations, request)); + assert.strictEqual( + (client.descriptors.page.listConversations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listConversationsStream with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listConversations.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listConversationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Conversation[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.Conversation) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listConversations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConversations, request)); + assert.strictEqual( + (client.descriptors.page.listConversations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listConversations without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), + ]; + client.descriptors.page.listConversations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IConversation[] = []; + const iterable = client.listConversationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listConversations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listConversations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listConversations with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listConversations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConversationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IConversation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listConversations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listConversations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listMessages', () => { + it('invokes listMessages without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListMessagesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + ]; + client.innerApiCalls.listMessages = stubSimpleCall(expectedResponse); + const [response] = await client.listMessages(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listMessages as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listMessages without error using callback', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListMessagesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + ]; + client.innerApiCalls.listMessages = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMessages( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IMessage[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listMessages as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listMessages with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListMessagesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listMessages = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMessages(request), expectedError); + assert((client.innerApiCalls.listMessages as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listMessagesStream without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListMessagesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + ]; + client.descriptors.page.listMessages.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listMessagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Message[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.Message) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMessages, request)); + assert.strictEqual( + (client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listMessagesStream with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListMessagesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listMessages.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listMessagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Message[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.Message) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMessages, request)); + assert.strictEqual( + (client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listMessages without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListMessagesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + ]; + client.descriptors.page.listMessages.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IMessage[] = []; + const iterable = client.listMessagesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listMessages.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listMessages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listMessages with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListMessagesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listMessages.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMessagesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IMessage[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listMessages.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listMessages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + 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 conversationsModule.v2.ConversationsClient({ + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + 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 conversationsModule.v2.ConversationsClient({ + 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/owl-bot-staging/v2/test/gapic_documents_v2.ts b/owl-bot-staging/v2/test/gapic_documents_v2.ts new file mode 100644 index 00000000..cbd9c415 --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_documents_v2.ts @@ -0,0 +1,2675 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as documentsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.DocumentsClient', () => { + it('has servicePath', () => { + const servicePath = documentsModule.v2.DocumentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = documentsModule.v2.DocumentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = documentsModule.v2.DocumentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new documentsModule.v2.DocumentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new documentsModule.v2.DocumentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.documentsStub, undefined); + await client.initialize(); + assert(client.documentsStub); + }); + + it('has close method', () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getDocument', () => { + it('invokes getDocument without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()); + client.innerApiCalls.getDocument = stubSimpleCall(expectedResponse); + const [response] = await client.getDocument(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getDocument without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()); + client.innerApiCalls.getDocument = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDocument( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IDocument|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getDocument with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getDocument = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getDocument(request), expectedError); + assert((client.innerApiCalls.getDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createDocument', () => { + it('invokes createDocument without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateDocumentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createDocument = stubLongRunningCall(expectedResponse); + const [operation] = await client.createDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createDocument without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateDocumentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createDocument = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDocument( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createDocument with call error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateDocumentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createDocument = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createDocument(request), expectedError); + assert((client.innerApiCalls.createDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createDocument with LRO error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateDocumentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createDocument = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createDocument(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateDocumentProgress without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateDocumentProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateDocumentProgress with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateDocumentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteDocument', () => { + it('invokes deleteDocument without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteDocument = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteDocument without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteDocument = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDocument( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteDocument with call error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDocument = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteDocument(request), expectedError); + assert((client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteDocument with LRO error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDocument = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteDocument(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteDocumentProgress without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteDocumentProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteDocumentProgress with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteDocumentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateDocument', () => { + it('invokes updateDocument without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateDocumentRequest()); + request.document = {}; + request.document.name = ''; + const expectedHeaderRequestParams = "document.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateDocument = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateDocument without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateDocumentRequest()); + request.document = {}; + request.document.name = ''; + const expectedHeaderRequestParams = "document.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateDocument = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDocument( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateDocument with call error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateDocumentRequest()); + request.document = {}; + request.document.name = ''; + const expectedHeaderRequestParams = "document.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDocument = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateDocument(request), expectedError); + assert((client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateDocument with LRO error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateDocumentRequest()); + request.document = {}; + request.document.name = ''; + const expectedHeaderRequestParams = "document.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDocument = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateDocument(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateDocumentProgress without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateDocumentProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateDocumentProgress with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateDocumentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('reloadDocument', () => { + it('invokes reloadDocument without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ReloadDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.reloadDocument = stubLongRunningCall(expectedResponse); + const [operation] = await client.reloadDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes reloadDocument without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ReloadDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.reloadDocument = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.reloadDocument( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes reloadDocument with call error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ReloadDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.reloadDocument = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.reloadDocument(request), expectedError); + assert((client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes reloadDocument with LRO error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ReloadDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.reloadDocument = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.reloadDocument(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkReloadDocumentProgress without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkReloadDocumentProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkReloadDocumentProgress with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkReloadDocumentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listDocuments', () => { + it('invokes listDocuments without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListDocumentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + ]; + client.innerApiCalls.listDocuments = stubSimpleCall(expectedResponse); + const [response] = await client.listDocuments(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listDocuments as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listDocuments without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListDocumentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + ]; + client.innerApiCalls.listDocuments = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDocuments( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IDocument[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listDocuments as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listDocuments with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListDocumentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listDocuments = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDocuments(request), expectedError); + assert((client.innerApiCalls.listDocuments as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listDocumentsStream without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListDocumentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + ]; + client.descriptors.page.listDocuments.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listDocumentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Document[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.Document) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDocuments, request)); + assert.strictEqual( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listDocumentsStream with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListDocumentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listDocuments.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listDocumentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Document[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.Document) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDocuments, request)); + assert.strictEqual( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listDocuments without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListDocumentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + ]; + client.descriptors.page.listDocuments.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IDocument[] = []; + const iterable = client.listDocumentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listDocuments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listDocuments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listDocuments with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListDocumentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listDocuments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDocumentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IDocument[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listDocuments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listDocuments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new documentsModule.v2.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.v2.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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new documentsModule.v2.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.v2.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/owl-bot-staging/v2/test/gapic_entity_types_v2.ts b/owl-bot-staging/v2/test/gapic_entity_types_v2.ts new file mode 100644 index 00000000..848273be --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_entity_types_v2.ts @@ -0,0 +1,3070 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as entitytypesModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.EntityTypesClient', () => { + it('has servicePath', () => { + const servicePath = entitytypesModule.v2.EntityTypesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = entitytypesModule.v2.EntityTypesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = entitytypesModule.v2.EntityTypesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new entitytypesModule.v2.EntityTypesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.entityTypesStub, undefined); + await client.initialize(); + assert(client.entityTypesStub); + }); + + it('has close method', () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getEntityType', () => { + it('invokes getEntityType without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()); + client.innerApiCalls.getEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.getEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getEntityType without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()); + client.innerApiCalls.getEntityType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEntityType( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IEntityType|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getEntityType with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getEntityType(request), expectedError); + assert((client.innerApiCalls.getEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createEntityType', () => { + it('invokes createEntityType without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateEntityTypeRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()); + client.innerApiCalls.createEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.createEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createEntityType without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateEntityTypeRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()); + client.innerApiCalls.createEntityType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createEntityType( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IEntityType|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createEntityType with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateEntityTypeRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createEntityType(request), expectedError); + assert((client.innerApiCalls.createEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateEntityType', () => { + it('invokes updateEntityType without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateEntityTypeRequest()); + request.entityType = {}; + request.entityType.name = ''; + const expectedHeaderRequestParams = "entity_type.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()); + client.innerApiCalls.updateEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.updateEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateEntityType without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateEntityTypeRequest()); + request.entityType = {}; + request.entityType.name = ''; + const expectedHeaderRequestParams = "entity_type.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()); + client.innerApiCalls.updateEntityType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateEntityType( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IEntityType|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateEntityType with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateEntityTypeRequest()); + request.entityType = {}; + request.entityType.name = ''; + const expectedHeaderRequestParams = "entity_type.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateEntityType(request), expectedError); + assert((client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteEntityType', () => { + it('invokes deleteEntityType without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.deleteEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteEntityType without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteEntityType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteEntityType( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteEntityType with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteEntityType(request), expectedError); + assert((client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('batchUpdateEntityTypes', () => { + it('invokes batchUpdateEntityTypes without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchUpdateEntityTypes(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchUpdateEntityTypes without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchUpdateEntityTypes( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchUpdateEntityTypes with call error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchUpdateEntityTypes(request), expectedError); + assert((client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchUpdateEntityTypes with LRO error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchUpdateEntityTypes(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkBatchUpdateEntityTypesProgress without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchUpdateEntityTypesProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchUpdateEntityTypesProgress with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBatchUpdateEntityTypesProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('batchDeleteEntityTypes', () => { + it('invokes batchDeleteEntityTypes without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchDeleteEntityTypes(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchDeleteEntityTypes without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchDeleteEntityTypes( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchDeleteEntityTypes with call error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchDeleteEntityTypes(request), expectedError); + assert((client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchDeleteEntityTypes with LRO error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchDeleteEntityTypes(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkBatchDeleteEntityTypesProgress without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchDeleteEntityTypesProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchDeleteEntityTypesProgress with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBatchDeleteEntityTypesProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('batchCreateEntities', () => { + it('invokes batchCreateEntities without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchCreateEntities = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchCreateEntities(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchCreateEntities without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchCreateEntities = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchCreateEntities( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchCreateEntities with call error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateEntities = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchCreateEntities(request), expectedError); + assert((client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchCreateEntities with LRO error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateEntities = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchCreateEntities(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkBatchCreateEntitiesProgress without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchCreateEntitiesProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchCreateEntitiesProgress with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBatchCreateEntitiesProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('batchUpdateEntities', () => { + it('invokes batchUpdateEntities without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchUpdateEntities = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchUpdateEntities(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchUpdateEntities without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchUpdateEntities = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchUpdateEntities( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchUpdateEntities with call error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntities = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchUpdateEntities(request), expectedError); + assert((client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchUpdateEntities with LRO error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntities = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchUpdateEntities(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkBatchUpdateEntitiesProgress without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchUpdateEntitiesProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchUpdateEntitiesProgress with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBatchUpdateEntitiesProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('batchDeleteEntities', () => { + it('invokes batchDeleteEntities without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchDeleteEntities = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchDeleteEntities(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchDeleteEntities without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchDeleteEntities = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchDeleteEntities( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchDeleteEntities with call error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntities = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchDeleteEntities(request), expectedError); + assert((client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchDeleteEntities with LRO error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntities = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchDeleteEntities(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkBatchDeleteEntitiesProgress without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchDeleteEntitiesProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchDeleteEntitiesProgress with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBatchDeleteEntitiesProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listEntityTypes', () => { + it('invokes listEntityTypes without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), + ]; + client.innerApiCalls.listEntityTypes = stubSimpleCall(expectedResponse); + const [response] = await client.listEntityTypes(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listEntityTypes without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), + ]; + client.innerApiCalls.listEntityTypes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listEntityTypes( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IEntityType[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listEntityTypes with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listEntityTypes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listEntityTypes(request), expectedError); + assert((client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listEntityTypesStream without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), + ]; + client.descriptors.page.listEntityTypes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listEntityTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.EntityType[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.EntityType) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listEntityTypes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listEntityTypes, request)); + assert.strictEqual( + (client.descriptors.page.listEntityTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listEntityTypesStream with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listEntityTypes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listEntityTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.EntityType[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.EntityType) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listEntityTypes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listEntityTypes, request)); + assert.strictEqual( + (client.descriptors.page.listEntityTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listEntityTypes without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), + ]; + client.descriptors.page.listEntityTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IEntityType[] = []; + const iterable = client.listEntityTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listEntityTypes with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listEntityTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listEntityTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IEntityType[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new entitytypesModule.v2.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.v2.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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new entitytypesModule.v2.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.v2.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/owl-bot-staging/v2/test/gapic_environments_v2.ts b/owl-bot-staging/v2/test/gapic_environments_v2.ts new file mode 100644 index 00000000..e1d153e7 --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_environments_v2.ts @@ -0,0 +1,2557 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as environmentsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.EnvironmentsClient', () => { + it('has servicePath', () => { + const servicePath = environmentsModule.v2.EnvironmentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = environmentsModule.v2.EnvironmentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = environmentsModule.v2.EnvironmentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new environmentsModule.v2.EnvironmentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.environmentsStub, undefined); + await client.initialize(); + assert(client.environmentsStub); + }); + + it('has close method', () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getEnvironment', () => { + it('invokes getEnvironment without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEnvironmentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()); + client.innerApiCalls.getEnvironment = stubSimpleCall(expectedResponse); + const [response] = await client.getEnvironment(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getEnvironment without error using callback', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEnvironmentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()); + client.innerApiCalls.getEnvironment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEnvironment( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IEnvironment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getEnvironment with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEnvironmentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getEnvironment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getEnvironment(request), expectedError); + assert((client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createEnvironment', () => { + it('invokes createEnvironment without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateEnvironmentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()); + client.innerApiCalls.createEnvironment = stubSimpleCall(expectedResponse); + const [response] = await client.createEnvironment(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createEnvironment without error using callback', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateEnvironmentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()); + client.innerApiCalls.createEnvironment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createEnvironment( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IEnvironment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createEnvironment with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateEnvironmentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createEnvironment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createEnvironment(request), expectedError); + assert((client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateEnvironment', () => { + it('invokes updateEnvironment without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateEnvironmentRequest()); + request.environment = {}; + request.environment.name = ''; + const expectedHeaderRequestParams = "environment.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()); + client.innerApiCalls.updateEnvironment = stubSimpleCall(expectedResponse); + const [response] = await client.updateEnvironment(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateEnvironment without error using callback', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateEnvironmentRequest()); + request.environment = {}; + request.environment.name = ''; + const expectedHeaderRequestParams = "environment.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()); + client.innerApiCalls.updateEnvironment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateEnvironment( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IEnvironment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateEnvironment with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateEnvironmentRequest()); + request.environment = {}; + request.environment.name = ''; + const expectedHeaderRequestParams = "environment.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEnvironment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateEnvironment(request), expectedError); + assert((client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteEnvironment', () => { + it('invokes deleteEnvironment without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteEnvironmentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteEnvironment = stubSimpleCall(expectedResponse); + const [response] = await client.deleteEnvironment(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteEnvironment without error using callback', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteEnvironmentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteEnvironment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteEnvironment( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteEnvironment with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteEnvironmentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteEnvironment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteEnvironment(request), expectedError); + assert((client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listEnvironments', () => { + it('invokes listEnvironments without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), + ]; + client.innerApiCalls.listEnvironments = stubSimpleCall(expectedResponse); + const [response] = await client.listEnvironments(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listEnvironments without error using callback', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), + ]; + client.innerApiCalls.listEnvironments = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listEnvironments( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IEnvironment[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listEnvironments with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listEnvironments = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listEnvironments(request), expectedError); + assert((client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listEnvironmentsStream without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), + ]; + client.descriptors.page.listEnvironments.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listEnvironmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Environment[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.Environment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listEnvironments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listEnvironments, request)); + assert.strictEqual( + (client.descriptors.page.listEnvironments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listEnvironmentsStream with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listEnvironments.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listEnvironmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Environment[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.Environment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listEnvironments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listEnvironments, request)); + assert.strictEqual( + (client.descriptors.page.listEnvironments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listEnvironments without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), + ]; + client.descriptors.page.listEnvironments.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IEnvironment[] = []; + const iterable = client.listEnvironmentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listEnvironments with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listEnvironments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listEnvironmentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IEnvironment[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('getEnvironmentHistory', () => { + it('invokes getEnvironmentHistory without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), + ]; + client.innerApiCalls.getEnvironmentHistory = stubSimpleCall(expectedResponse); + const [response] = await client.getEnvironmentHistory(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getEnvironmentHistory as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getEnvironmentHistory without error using callback', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), + ]; + client.innerApiCalls.getEnvironmentHistory = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEnvironmentHistory( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getEnvironmentHistory as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getEnvironmentHistory with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getEnvironmentHistory = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getEnvironmentHistory(request), expectedError); + assert((client.innerApiCalls.getEnvironmentHistory as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getEnvironmentHistoryStream without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), + ]; + client.descriptors.page.getEnvironmentHistory.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.getEnvironmentHistoryStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.getEnvironmentHistory, request)); + assert.strictEqual( + (client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes getEnvironmentHistoryStream with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.getEnvironmentHistory.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.getEnvironmentHistoryStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.getEnvironmentHistory, request)); + assert.strictEqual( + (client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with getEnvironmentHistory without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), + ]; + client.descriptors.page.getEnvironmentHistory.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry[] = []; + const iterable = client.getEnvironmentHistoryAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with getEnvironmentHistory with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.getEnvironmentHistory.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.getEnvironmentHistoryAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new environmentsModule.v2.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.v2.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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new environmentsModule.v2.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.v2.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/owl-bot-staging/v2/test/gapic_fulfillments_v2.ts b/owl-bot-staging/v2/test/gapic_fulfillments_v2.ts new file mode 100644 index 00000000..ec0e896f --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_fulfillments_v2.ts @@ -0,0 +1,1866 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as fulfillmentsModule from '../src'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +describe('v2.FulfillmentsClient', () => { + it('has servicePath', () => { + const servicePath = fulfillmentsModule.v2.FulfillmentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = fulfillmentsModule.v2.FulfillmentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = fulfillmentsModule.v2.FulfillmentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.fulfillmentsStub, undefined); + await client.initialize(); + assert(client.fulfillmentsStub); + }); + + it('has close method', () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getFulfillment', () => { + it('invokes getFulfillment without error', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetFulfillmentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Fulfillment()); + client.innerApiCalls.getFulfillment = stubSimpleCall(expectedResponse); + const [response] = await client.getFulfillment(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getFulfillment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getFulfillment without error using callback', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetFulfillmentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Fulfillment()); + client.innerApiCalls.getFulfillment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFulfillment( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IFulfillment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getFulfillment as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getFulfillment with error', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetFulfillmentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getFulfillment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFulfillment(request), expectedError); + assert((client.innerApiCalls.getFulfillment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateFulfillment', () => { + it('invokes updateFulfillment without error', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateFulfillmentRequest()); + request.fulfillment = {}; + request.fulfillment.name = ''; + const expectedHeaderRequestParams = "fulfillment.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Fulfillment()); + client.innerApiCalls.updateFulfillment = stubSimpleCall(expectedResponse); + const [response] = await client.updateFulfillment(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateFulfillment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateFulfillment without error using callback', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateFulfillmentRequest()); + request.fulfillment = {}; + request.fulfillment.name = ''; + const expectedHeaderRequestParams = "fulfillment.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Fulfillment()); + client.innerApiCalls.updateFulfillment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFulfillment( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IFulfillment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateFulfillment as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateFulfillment with error', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateFulfillmentRequest()); + request.fulfillment = {}; + request.fulfillment.name = ''; + const expectedHeaderRequestParams = "fulfillment.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFulfillment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateFulfillment(request), expectedError); + assert((client.innerApiCalls.updateFulfillment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('Path templates', () => { + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + 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 fulfillmentsModule.v2.FulfillmentsClient({ + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + 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 fulfillmentsModule.v2.FulfillmentsClient({ + 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/owl-bot-staging/v2/test/gapic_intents_v2.ts b/owl-bot-staging/v2/test/gapic_intents_v2.ts new file mode 100644 index 00000000..1266fac0 --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_intents_v2.ts @@ -0,0 +1,2638 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as intentsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.IntentsClient', () => { + it('has servicePath', () => { + const servicePath = intentsModule.v2.IntentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = intentsModule.v2.IntentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = intentsModule.v2.IntentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new intentsModule.v2.IntentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new intentsModule.v2.IntentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.intentsStub, undefined); + await client.initialize(); + assert(client.intentsStub); + }); + + it('has close method', () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getIntent', () => { + it('invokes getIntent without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetIntentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()); + client.innerApiCalls.getIntent = stubSimpleCall(expectedResponse); + const [response] = await client.getIntent(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getIntent without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetIntentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()); + client.innerApiCalls.getIntent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIntent( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IIntent|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getIntent with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetIntentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIntent(request), expectedError); + assert((client.innerApiCalls.getIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createIntent', () => { + it('invokes createIntent without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateIntentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()); + client.innerApiCalls.createIntent = stubSimpleCall(expectedResponse); + const [response] = await client.createIntent(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createIntent without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateIntentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()); + client.innerApiCalls.createIntent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createIntent( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IIntent|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createIntent with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateIntentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createIntent(request), expectedError); + assert((client.innerApiCalls.createIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateIntent', () => { + it('invokes updateIntent without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateIntentRequest()); + request.intent = {}; + request.intent.name = ''; + const expectedHeaderRequestParams = "intent.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()); + client.innerApiCalls.updateIntent = stubSimpleCall(expectedResponse); + const [response] = await client.updateIntent(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateIntent without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateIntentRequest()); + request.intent = {}; + request.intent.name = ''; + const expectedHeaderRequestParams = "intent.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()); + client.innerApiCalls.updateIntent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateIntent( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IIntent|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateIntent with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateIntentRequest()); + request.intent = {}; + request.intent.name = ''; + const expectedHeaderRequestParams = "intent.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateIntent(request), expectedError); + assert((client.innerApiCalls.updateIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteIntent', () => { + it('invokes deleteIntent without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteIntentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteIntent = stubSimpleCall(expectedResponse); + const [response] = await client.deleteIntent(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteIntent without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteIntentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteIntent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteIntent( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteIntent with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteIntentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteIntent(request), expectedError); + assert((client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('batchUpdateIntents', () => { + it('invokes batchUpdateIntents without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchUpdateIntents = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchUpdateIntents(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchUpdateIntents without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchUpdateIntents = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchUpdateIntents( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchUpdateIntents with call error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateIntents = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchUpdateIntents(request), expectedError); + assert((client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchUpdateIntents with LRO error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateIntents = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchUpdateIntents(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkBatchUpdateIntentsProgress without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchUpdateIntentsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchUpdateIntentsProgress with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBatchUpdateIntentsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('batchDeleteIntents', () => { + it('invokes batchDeleteIntents without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchDeleteIntents = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchDeleteIntents(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchDeleteIntents without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchDeleteIntents = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchDeleteIntents( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchDeleteIntents with call error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteIntents = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchDeleteIntents(request), expectedError); + assert((client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchDeleteIntents with LRO error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteIntents = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchDeleteIntents(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkBatchDeleteIntentsProgress without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchDeleteIntentsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchDeleteIntentsProgress with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBatchDeleteIntentsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listIntents', () => { + it('invokes listIntents without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + ]; + client.innerApiCalls.listIntents = stubSimpleCall(expectedResponse); + const [response] = await client.listIntents(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listIntents without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + ]; + client.innerApiCalls.listIntents = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listIntents( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IIntent[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listIntents with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listIntents = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listIntents(request), expectedError); + assert((client.innerApiCalls.listIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listIntentsStream without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + ]; + client.descriptors.page.listIntents.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listIntentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Intent[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.Intent) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listIntents.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listIntents, request)); + assert.strictEqual( + (client.descriptors.page.listIntents.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listIntentsStream with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listIntents.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listIntentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Intent[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.Intent) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listIntents.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listIntents, request)); + assert.strictEqual( + (client.descriptors.page.listIntents.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listIntents without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + ]; + client.descriptors.page.listIntents.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IIntent[] = []; + const iterable = client.listIntentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listIntents.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listIntents.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listIntents with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listIntents.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listIntentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IIntent[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listIntents.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listIntents.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new intentsModule.v2.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.v2.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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new intentsModule.v2.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.v2.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/owl-bot-staging/v2/test/gapic_knowledge_bases_v2.ts b/owl-bot-staging/v2/test/gapic_knowledge_bases_v2.ts new file mode 100644 index 00000000..338a4b04 --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_knowledge_bases_v2.ts @@ -0,0 +1,2334 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as knowledgebasesModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.KnowledgeBasesClient', () => { + it('has servicePath', () => { + const servicePath = knowledgebasesModule.v2.KnowledgeBasesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = knowledgebasesModule.v2.KnowledgeBasesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = knowledgebasesModule.v2.KnowledgeBasesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.knowledgeBasesStub, undefined); + await client.initialize(); + assert(client.knowledgeBasesStub); + }); + + it('has close method', () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getKnowledgeBase', () => { + it('invokes getKnowledgeBase without error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()); + client.innerApiCalls.getKnowledgeBase = stubSimpleCall(expectedResponse); + const [response] = await client.getKnowledgeBase(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getKnowledgeBase without error using callback', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()); + client.innerApiCalls.getKnowledgeBase = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getKnowledgeBase( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IKnowledgeBase|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getKnowledgeBase with error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getKnowledgeBase = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getKnowledgeBase(request), expectedError); + assert((client.innerApiCalls.getKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createKnowledgeBase', () => { + it('invokes createKnowledgeBase without error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()); + client.innerApiCalls.createKnowledgeBase = stubSimpleCall(expectedResponse); + const [response] = await client.createKnowledgeBase(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createKnowledgeBase without error using callback', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()); + client.innerApiCalls.createKnowledgeBase = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createKnowledgeBase( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IKnowledgeBase|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createKnowledgeBase with error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createKnowledgeBase = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createKnowledgeBase(request), expectedError); + assert((client.innerApiCalls.createKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteKnowledgeBase', () => { + it('invokes deleteKnowledgeBase without error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteKnowledgeBase = stubSimpleCall(expectedResponse); + const [response] = await client.deleteKnowledgeBase(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteKnowledgeBase without error using callback', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteKnowledgeBase = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteKnowledgeBase( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteKnowledgeBase with error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteKnowledgeBase = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteKnowledgeBase(request), expectedError); + assert((client.innerApiCalls.deleteKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateKnowledgeBase', () => { + it('invokes updateKnowledgeBase without error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest()); + request.knowledgeBase = {}; + request.knowledgeBase.name = ''; + const expectedHeaderRequestParams = "knowledge_base.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()); + client.innerApiCalls.updateKnowledgeBase = stubSimpleCall(expectedResponse); + const [response] = await client.updateKnowledgeBase(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateKnowledgeBase without error using callback', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest()); + request.knowledgeBase = {}; + request.knowledgeBase.name = ''; + const expectedHeaderRequestParams = "knowledge_base.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()); + client.innerApiCalls.updateKnowledgeBase = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateKnowledgeBase( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IKnowledgeBase|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateKnowledgeBase with error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest()); + request.knowledgeBase = {}; + request.knowledgeBase.name = ''; + const expectedHeaderRequestParams = "knowledge_base.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateKnowledgeBase = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateKnowledgeBase(request), expectedError); + assert((client.innerApiCalls.updateKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listKnowledgeBases', () => { + it('invokes listKnowledgeBases without error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), + ]; + client.innerApiCalls.listKnowledgeBases = stubSimpleCall(expectedResponse); + const [response] = await client.listKnowledgeBases(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listKnowledgeBases as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listKnowledgeBases without error using callback', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), + ]; + client.innerApiCalls.listKnowledgeBases = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listKnowledgeBases( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IKnowledgeBase[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listKnowledgeBases as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listKnowledgeBases with error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listKnowledgeBases = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listKnowledgeBases(request), expectedError); + assert((client.innerApiCalls.listKnowledgeBases as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listKnowledgeBasesStream without error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), + ]; + client.descriptors.page.listKnowledgeBases.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listKnowledgeBasesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.KnowledgeBase[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.KnowledgeBase) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listKnowledgeBases.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listKnowledgeBases, request)); + assert.strictEqual( + (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listKnowledgeBasesStream with error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listKnowledgeBases.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listKnowledgeBasesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.KnowledgeBase[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.KnowledgeBase) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listKnowledgeBases.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listKnowledgeBases, request)); + assert.strictEqual( + (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listKnowledgeBases without error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), + ]; + client.descriptors.page.listKnowledgeBases.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IKnowledgeBase[] = []; + const iterable = client.listKnowledgeBasesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listKnowledgeBases with error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listKnowledgeBases.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listKnowledgeBasesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IKnowledgeBase[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new knowledgebasesModule.v2.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.v2.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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new knowledgebasesModule.v2.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.v2.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/owl-bot-staging/v2/test/gapic_participants_v2.ts b/owl-bot-staging/v2/test/gapic_participants_v2.ts new file mode 100644 index 00000000..3fb660af --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_participants_v2.ts @@ -0,0 +1,2502 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as participantsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.ParticipantsClient', () => { + it('has servicePath', () => { + const servicePath = participantsModule.v2.ParticipantsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = participantsModule.v2.ParticipantsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = participantsModule.v2.ParticipantsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new participantsModule.v2.ParticipantsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new participantsModule.v2.ParticipantsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.participantsStub, undefined); + await client.initialize(); + assert(client.participantsStub); + }); + + it('has close method', () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createParticipant', () => { + it('invokes createParticipant without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateParticipantRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()); + client.innerApiCalls.createParticipant = stubSimpleCall(expectedResponse); + const [response] = await client.createParticipant(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createParticipant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createParticipant without error using callback', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateParticipantRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()); + client.innerApiCalls.createParticipant = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createParticipant( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IParticipant|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createParticipant as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createParticipant with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateParticipantRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createParticipant = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createParticipant(request), expectedError); + assert((client.innerApiCalls.createParticipant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getParticipant', () => { + it('invokes getParticipant without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetParticipantRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()); + client.innerApiCalls.getParticipant = stubSimpleCall(expectedResponse); + const [response] = await client.getParticipant(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getParticipant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getParticipant without error using callback', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetParticipantRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()); + client.innerApiCalls.getParticipant = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getParticipant( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IParticipant|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getParticipant as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getParticipant with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetParticipantRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getParticipant = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getParticipant(request), expectedError); + assert((client.innerApiCalls.getParticipant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateParticipant', () => { + it('invokes updateParticipant without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateParticipantRequest()); + request.participant = {}; + request.participant.name = ''; + const expectedHeaderRequestParams = "participant.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()); + client.innerApiCalls.updateParticipant = stubSimpleCall(expectedResponse); + const [response] = await client.updateParticipant(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateParticipant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateParticipant without error using callback', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateParticipantRequest()); + request.participant = {}; + request.participant.name = ''; + const expectedHeaderRequestParams = "participant.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()); + client.innerApiCalls.updateParticipant = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateParticipant( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IParticipant|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateParticipant as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateParticipant with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateParticipantRequest()); + request.participant = {}; + request.participant.name = ''; + const expectedHeaderRequestParams = "participant.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateParticipant = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateParticipant(request), expectedError); + assert((client.innerApiCalls.updateParticipant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('analyzeContent', () => { + it('invokes analyzeContent without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnalyzeContentRequest()); + request.participant = ''; + const expectedHeaderRequestParams = "participant="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnalyzeContentResponse()); + client.innerApiCalls.analyzeContent = stubSimpleCall(expectedResponse); + const [response] = await client.analyzeContent(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.analyzeContent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes analyzeContent without error using callback', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnalyzeContentRequest()); + request.participant = ''; + const expectedHeaderRequestParams = "participant="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnalyzeContentResponse()); + client.innerApiCalls.analyzeContent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.analyzeContent( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.analyzeContent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes analyzeContent with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnalyzeContentRequest()); + request.participant = ''; + const expectedHeaderRequestParams = "participant="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeContent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.analyzeContent(request), expectedError); + assert((client.innerApiCalls.analyzeContent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('suggestArticles', () => { + it('invokes suggestArticles without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SuggestArticlesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SuggestArticlesResponse()); + client.innerApiCalls.suggestArticles = stubSimpleCall(expectedResponse); + const [response] = await client.suggestArticles(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.suggestArticles as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes suggestArticles without error using callback', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SuggestArticlesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SuggestArticlesResponse()); + client.innerApiCalls.suggestArticles = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.suggestArticles( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.suggestArticles as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes suggestArticles with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SuggestArticlesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.suggestArticles = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.suggestArticles(request), expectedError); + assert((client.innerApiCalls.suggestArticles as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('suggestFaqAnswers', () => { + it('invokes suggestFaqAnswers without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SuggestFaqAnswersResponse()); + client.innerApiCalls.suggestFaqAnswers = stubSimpleCall(expectedResponse); + const [response] = await client.suggestFaqAnswers(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.suggestFaqAnswers as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes suggestFaqAnswers without error using callback', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SuggestFaqAnswersResponse()); + client.innerApiCalls.suggestFaqAnswers = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.suggestFaqAnswers( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.suggestFaqAnswers as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes suggestFaqAnswers with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.suggestFaqAnswers = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.suggestFaqAnswers(request), expectedError); + assert((client.innerApiCalls.suggestFaqAnswers as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listParticipants', () => { + it('invokes listParticipants without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListParticipantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), + ]; + client.innerApiCalls.listParticipants = stubSimpleCall(expectedResponse); + const [response] = await client.listParticipants(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listParticipants as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listParticipants without error using callback', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListParticipantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), + ]; + client.innerApiCalls.listParticipants = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listParticipants( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IParticipant[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listParticipants as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listParticipants with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListParticipantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listParticipants = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listParticipants(request), expectedError); + assert((client.innerApiCalls.listParticipants as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listParticipantsStream without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListParticipantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), + ]; + client.descriptors.page.listParticipants.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listParticipantsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Participant[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.Participant) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listParticipants.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listParticipants, request)); + assert.strictEqual( + (client.descriptors.page.listParticipants.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listParticipantsStream with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListParticipantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listParticipants.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listParticipantsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Participant[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.Participant) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listParticipants.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listParticipants, request)); + assert.strictEqual( + (client.descriptors.page.listParticipants.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listParticipants without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListParticipantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), + ]; + client.descriptors.page.listParticipants.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IParticipant[] = []; + const iterable = client.listParticipantsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listParticipants.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listParticipants.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listParticipants with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListParticipantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listParticipants.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listParticipantsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IParticipant[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listParticipants.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listParticipants.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + 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 participantsModule.v2.ParticipantsClient({ + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + 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 participantsModule.v2.ParticipantsClient({ + 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/owl-bot-staging/v2/test/gapic_session_entity_types_v2.ts b/owl-bot-staging/v2/test/gapic_session_entity_types_v2.ts new file mode 100644 index 00000000..c76ee104 --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_session_entity_types_v2.ts @@ -0,0 +1,2372 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as sessionentitytypesModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.SessionEntityTypesClient', () => { + it('has servicePath', () => { + const servicePath = sessionentitytypesModule.v2.SessionEntityTypesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = sessionentitytypesModule.v2.SessionEntityTypesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = sessionentitytypesModule.v2.SessionEntityTypesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sessionEntityTypesStub, undefined); + await client.initialize(); + assert(client.sessionEntityTypesStub); + }); + + it('has close method', () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getSessionEntityType', () => { + it('invokes getSessionEntityType without error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()); + client.innerApiCalls.getSessionEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.getSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getSessionEntityType without error using callback', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()); + client.innerApiCalls.getSessionEntityType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSessionEntityType( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.ISessionEntityType|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getSessionEntityType with error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getSessionEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSessionEntityType(request), expectedError); + assert((client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createSessionEntityType', () => { + it('invokes createSessionEntityType without error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()); + client.innerApiCalls.createSessionEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.createSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createSessionEntityType without error using callback', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()); + client.innerApiCalls.createSessionEntityType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSessionEntityType( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.ISessionEntityType|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createSessionEntityType with error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createSessionEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSessionEntityType(request), expectedError); + assert((client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateSessionEntityType', () => { + it('invokes updateSessionEntityType without error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest()); + request.sessionEntityType = {}; + request.sessionEntityType.name = ''; + const expectedHeaderRequestParams = "session_entity_type.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()); + client.innerApiCalls.updateSessionEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.updateSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateSessionEntityType without error using callback', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest()); + request.sessionEntityType = {}; + request.sessionEntityType.name = ''; + const expectedHeaderRequestParams = "session_entity_type.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()); + client.innerApiCalls.updateSessionEntityType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSessionEntityType( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.ISessionEntityType|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateSessionEntityType with error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest()); + request.sessionEntityType = {}; + request.sessionEntityType.name = ''; + const expectedHeaderRequestParams = "session_entity_type.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSessionEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSessionEntityType(request), expectedError); + assert((client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteSessionEntityType', () => { + it('invokes deleteSessionEntityType without error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteSessionEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.deleteSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteSessionEntityType without error using callback', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteSessionEntityType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSessionEntityType( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteSessionEntityType with error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSessionEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteSessionEntityType(request), expectedError); + assert((client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listSessionEntityTypes', () => { + it('invokes listSessionEntityTypes without error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), + ]; + client.innerApiCalls.listSessionEntityTypes = stubSimpleCall(expectedResponse); + const [response] = await client.listSessionEntityTypes(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSessionEntityTypes without error using callback', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), + ]; + client.innerApiCalls.listSessionEntityTypes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSessionEntityTypes( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.ISessionEntityType[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listSessionEntityTypes with error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listSessionEntityTypes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSessionEntityTypes(request), expectedError); + assert((client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSessionEntityTypesStream without error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), + ]; + client.descriptors.page.listSessionEntityTypes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSessionEntityTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.SessionEntityType[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.SessionEntityType) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSessionEntityTypes, request)); + assert.strictEqual( + (client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listSessionEntityTypesStream with error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listSessionEntityTypes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSessionEntityTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.SessionEntityType[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.SessionEntityType) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSessionEntityTypes, request)); + assert.strictEqual( + (client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSessionEntityTypes without error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), + ]; + client.descriptors.page.listSessionEntityTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.ISessionEntityType[] = []; + const iterable = client.listSessionEntityTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSessionEntityTypes with error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listSessionEntityTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSessionEntityTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.ISessionEntityType[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSession', () => { + const fakePath = "/rendered/path/projectAgentSession"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionPath', () => { + const result = client.projectAgentSessionPath("projectValue", "sessionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionName', () => { + const result = client.matchProjectFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionName', () => { + const result = client.matchSessionFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new sessionentitytypesModule.v2.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.v2.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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new sessionentitytypesModule.v2.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.v2.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/owl-bot-staging/v2/test/gapic_sessions_v2.ts b/owl-bot-staging/v2/test/gapic_sessions_v2.ts new file mode 100644 index 00000000..f333f350 --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_sessions_v2.ts @@ -0,0 +1,2046 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as sessionsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubBidiStreamingCall(response?: ResponseType, error?: Error) { + const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + return sinon.stub().returns(mockStream); +} + +describe('v2.SessionsClient', () => { + it('has servicePath', () => { + const servicePath = sessionsModule.v2.SessionsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = sessionsModule.v2.SessionsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = sessionsModule.v2.SessionsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sessionsModule.v2.SessionsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sessionsModule.v2.SessionsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sessionsStub, undefined); + await client.initialize(); + assert(client.sessionsStub); + }); + + it('has close method', () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('detectIntent', () => { + it('invokes detectIntent without error', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DetectIntentRequest()); + request.session = ''; + const expectedHeaderRequestParams = "session="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DetectIntentResponse()); + client.innerApiCalls.detectIntent = stubSimpleCall(expectedResponse); + const [response] = await client.detectIntent(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.detectIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes detectIntent without error using callback', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DetectIntentRequest()); + request.session = ''; + const expectedHeaderRequestParams = "session="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DetectIntentResponse()); + client.innerApiCalls.detectIntent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.detectIntent( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IDetectIntentResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.detectIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes detectIntent with error', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DetectIntentRequest()); + request.session = ''; + const expectedHeaderRequestParams = "session="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.detectIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.detectIntent(request), expectedError); + assert((client.innerApiCalls.detectIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('streamingDetectIntent', () => { + it('invokes streamingDetectIntent without error', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.StreamingDetectIntentRequest()); + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.StreamingDetectIntentResponse()); + client.innerApiCalls.streamingDetectIntent = stubBidiStreamingCall(expectedResponse); + const stream = client.streamingDetectIntent(); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.cloud.dialogflow.v2.StreamingDetectIntentResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.streamingDetectIntent as SinonStub) + .getCall(0).calledWithExactly(undefined)); + assert.deepStrictEqual(((stream as unknown as PassThrough) + ._transform as SinonStub).getCall(0).args[0], request); + }); + + it('invokes streamingDetectIntent with error', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.StreamingDetectIntentRequest());const expectedError = new Error('expected'); + client.innerApiCalls.streamingDetectIntent = stubBidiStreamingCall(undefined, expectedError); + const stream = client.streamingDetectIntent(); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.cloud.dialogflow.v2.StreamingDetectIntentResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert((client.innerApiCalls.streamingDetectIntent as SinonStub) + .getCall(0).calledWithExactly(undefined)); + assert.deepStrictEqual(((stream as unknown as PassThrough) + ._transform as SinonStub).getCall(0).args[0], request); + }); + }); + + describe('Path templates', () => { + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSession', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSession"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionPath', () => { + const result = client.projectAgentEnvironmentUserSessionPath("projectValue", "environmentValue", "userValue", "sessionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSession', () => { + const fakePath = "/rendered/path/projectAgentSession"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionPath', () => { + const result = client.projectAgentSessionPath("projectValue", "sessionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionName', () => { + const result = client.matchProjectFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionName', () => { + const result = client.matchSessionFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new sessionsModule.v2.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.v2.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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSession', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSession"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSession', () => { + const fakePath = "/rendered/path/projectLocationAgentSession"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionPath', () => { + const result = client.projectLocationAgentSessionPath("projectValue", "locationValue", "sessionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new sessionsModule.v2.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.v2.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)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v2/test/gapic_versions_v2.ts b/owl-bot-staging/v2/test/gapic_versions_v2.ts new file mode 100644 index 00000000..bbf5b6d5 --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_versions_v2.ts @@ -0,0 +1,2334 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as versionsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.VersionsClient', () => { + it('has servicePath', () => { + const servicePath = versionsModule.v2.VersionsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = versionsModule.v2.VersionsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = versionsModule.v2.VersionsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new versionsModule.v2.VersionsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new versionsModule.v2.VersionsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.versionsStub, undefined); + await client.initialize(); + assert(client.versionsStub); + }); + + it('has close method', () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getVersion', () => { + it('invokes getVersion without error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()); + client.innerApiCalls.getVersion = stubSimpleCall(expectedResponse); + const [response] = await client.getVersion(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getVersion without error using callback', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()); + client.innerApiCalls.getVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getVersion( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getVersion with error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getVersion(request), expectedError); + assert((client.innerApiCalls.getVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createVersion', () => { + it('invokes createVersion without error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateVersionRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()); + client.innerApiCalls.createVersion = stubSimpleCall(expectedResponse); + const [response] = await client.createVersion(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createVersion without error using callback', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateVersionRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()); + client.innerApiCalls.createVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createVersion( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createVersion with error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateVersionRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createVersion(request), expectedError); + assert((client.innerApiCalls.createVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateVersion', () => { + it('invokes updateVersion without error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateVersionRequest()); + request.version = {}; + request.version.name = ''; + const expectedHeaderRequestParams = "version.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()); + client.innerApiCalls.updateVersion = stubSimpleCall(expectedResponse); + const [response] = await client.updateVersion(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateVersion without error using callback', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateVersionRequest()); + request.version = {}; + request.version.name = ''; + const expectedHeaderRequestParams = "version.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()); + client.innerApiCalls.updateVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateVersion( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateVersion with error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateVersionRequest()); + request.version = {}; + request.version.name = ''; + const expectedHeaderRequestParams = "version.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateVersion(request), expectedError); + assert((client.innerApiCalls.updateVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteVersion', () => { + it('invokes deleteVersion without error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteVersion = stubSimpleCall(expectedResponse); + const [response] = await client.deleteVersion(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteVersion without error using callback', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteVersion( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteVersion with error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteVersion(request), expectedError); + assert((client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listVersions', () => { + it('invokes listVersions without error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + ]; + client.innerApiCalls.listVersions = stubSimpleCall(expectedResponse); + const [response] = await client.listVersions(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listVersions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listVersions without error using callback', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + ]; + client.innerApiCalls.listVersions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listVersions( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IVersion[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listVersions as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listVersions with error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listVersions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listVersions(request), expectedError); + assert((client.innerApiCalls.listVersions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listVersionsStream without error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + ]; + client.descriptors.page.listVersions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Version[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.Version) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listVersions, request)); + assert.strictEqual( + (client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listVersionsStream with error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listVersions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Version[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.Version) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listVersions, request)); + assert.strictEqual( + (client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listVersions without error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + ]; + client.descriptors.page.listVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IVersion[] = []; + const iterable = client.listVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listVersions with error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IVersion[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new versionsModule.v2.VersionsClient({ + 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 versionsModule.v2.VersionsClient({ + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new versionsModule.v2.VersionsClient({ + 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 versionsModule.v2.VersionsClient({ + 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/owl-bot-staging/v2/tsconfig.json b/owl-bot-staging/v2/tsconfig.json new file mode 100644 index 00000000..c78f1c88 --- /dev/null +++ b/owl-bot-staging/v2/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v2/webpack.config.js b/owl-bot-staging/v2/webpack.config.js new file mode 100644 index 00000000..0d2fc635 --- /dev/null +++ b/owl-bot-staging/v2/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'dialogflow', + filename: './dialogflow.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; diff --git a/owl-bot-staging/v2beta1/.eslintignore b/owl-bot-staging/v2beta1/.eslintignore new file mode 100644 index 00000000..521dc25a --- /dev/null +++ b/owl-bot-staging/v2beta1/.eslintignore @@ -0,0 +1,6 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ diff --git a/owl-bot-staging/v2beta1/.eslintrc.json b/owl-bot-staging/v2beta1/.eslintrc.json new file mode 100644 index 00000000..78215349 --- /dev/null +++ b/owl-bot-staging/v2beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v2beta1/.gitignore b/owl-bot-staging/v2beta1/.gitignore new file mode 100644 index 00000000..5d32b237 --- /dev/null +++ b/owl-bot-staging/v2beta1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/v2beta1/.jsdoc.js b/owl-bot-staging/v2beta1/.jsdoc.js new file mode 100644 index 00000000..01541b4a --- /dev/null +++ b/owl-bot-staging/v2beta1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2021 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/dialogflow', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v2beta1/.mocharc.js b/owl-bot-staging/v2beta1/.mocharc.js new file mode 100644 index 00000000..50bc7f79 --- /dev/null +++ b/owl-bot-staging/v2beta1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v2beta1/.prettierrc.js b/owl-bot-staging/v2beta1/.prettierrc.js new file mode 100644 index 00000000..84f4713a --- /dev/null +++ b/owl-bot-staging/v2beta1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v2beta1/README.md b/owl-bot-staging/v2beta1/README.md new file mode 100644 index 00000000..f592662a --- /dev/null +++ b/owl-bot-staging/v2beta1/README.md @@ -0,0 +1 @@ +Dialogflow: Nodejs Client diff --git a/owl-bot-staging/v2beta1/linkinator.config.json b/owl-bot-staging/v2beta1/linkinator.config.json new file mode 100644 index 00000000..29a223b6 --- /dev/null +++ b/owl-bot-staging/v2beta1/linkinator.config.json @@ -0,0 +1,10 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io" + ], + "silent": true, + "concurrency": 10 +} diff --git a/owl-bot-staging/v2beta1/package.json b/owl-bot-staging/v2beta1/package.json new file mode 100644 index 00000000..050cef0d --- /dev/null +++ b/owl-bot-staging/v2beta1/package.json @@ -0,0 +1,78 @@ +{ + "name": "@google-cloud/dialogflow", + "version": "0.1.0", + "description": "Dialogflow client for Node.js", + "repository": "googleapis/nodejs-dialogflow", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google dialogflow", + "dialogflow", + "agents", + "answer records", + "contexts", + "conversation profiles", + "conversations", + "documents", + "entity types", + "environments", + "fulfillments", + "intents", + "knowledge bases", + "participants", + "session entity types", + "sessions", + "versions" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^2.19.0" + }, + "devDependencies": { + "@types/mocha": "^9.0.0", + "@types/node": "^14.17.3", + "@types/sinon": "^10.0.2", + "c8": "^7.7.3", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.0", + "jsdoc-region-tag": "^1.1.0", + "linkinator": "^2.13.6", + "mocha": "^9.0.2", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^11.1.1", + "ts-loader": "^9.2.3", + "typescript": "^4.3.4", + "webpack": "^5.39.1", + "webpack-cli": "^4.7.2" + }, + "engines": { + "node": ">=v10.24.0" + } +} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/agent.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/agent.proto new file mode 100644 index 00000000..49c464e8 --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/agent.proto @@ -0,0 +1,519 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2beta1/environment.proto"; +import "google/cloud/dialogflow/v2beta1/validation_result.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "AgentProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Agents][google.cloud.dialogflow.v2beta1.Agent]. +service Agents { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Retrieves the specified agent. + rpc GetAgent(GetAgentRequest) returns (Agent) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*}/agent" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*}/agent" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Creates/updates the specified agent. + rpc SetAgent(SetAgentRequest) returns (Agent) { + option (google.api.http) = { + post: "/v2beta1/{agent.parent=projects/*}/agent" + body: "agent" + additional_bindings { + post: "/v2beta1/{agent.parent=projects/*/locations/*}/agent" + body: "agent" + } + }; + option (google.api.method_signature) = "agent"; + } + + // Deletes the specified agent. + rpc DeleteAgent(DeleteAgentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta1/{parent=projects/*}/agent" + additional_bindings { + delete: "/v2beta1/{parent=projects/*/locations/*}/agent" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Returns the list of agents. + // Since there is at most one conversational agent per project, this method is + // useful primarily for listing all agents across projects the caller has + // access to. One can achieve that with a wildcard project collection id "-". + // Refer to [List + // Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). + rpc SearchAgents(SearchAgentsRequest) returns (SearchAgentsResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*}/agent:search" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*}/agent:search" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Trains the specified agent. + // + // + // Operation + rpc TrainAgent(TrainAgentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*}/agent:train" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*}/agent:train" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Exports the specified agent to a ZIP file. + // + // + // Operation + rpc ExportAgent(ExportAgentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*}/agent:export" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*}/agent:export" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.dialogflow.v2beta1.ExportAgentResponse" + metadata_type: "google.protobuf.Struct" + }; + } + + // Imports the specified agent from a ZIP file. + // + // Uploads new intents and entity types without deleting the existing ones. + // Intents and entity types with the same name are replaced with the new + // versions from [ImportAgentRequest][google.cloud.dialogflow.v2beta1.ImportAgentRequest]. After the import, the imported draft + // agent will be trained automatically (unless disabled in agent settings). + // However, once the import is done, training may not be completed yet. Please + // call [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it returns in order to train + // explicitly. + // + // + // Operation + // An operation which tracks when importing is complete. It only tracks + // when the draft agent is updated not when it is done training. + rpc ImportAgent(ImportAgentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*}/agent:import" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*}/agent:import" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Restores the specified agent from a ZIP file. + // + // Replaces the current agent version with a new one. All the intents and + // entity types in the older version are deleted. After the restore, the + // restored draft agent will be trained automatically (unless disabled in + // agent settings). However, once the restore is done, training may not be + // completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it + // returns in order to train explicitly. + // + // + // Operation + // An operation which tracks when restoring is complete. It only tracks + // when the draft agent is updated not when it is done training. + rpc RestoreAgent(RestoreAgentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*}/agent:restore" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*}/agent:restore" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Gets agent validation result. Agent validation is performed during + // training time and is updated automatically when training is completed. + rpc GetValidationResult(GetValidationResultRequest) returns (ValidationResult) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*}/agent/validationResult" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*}/agent/validationResult" + } + }; + } +} + +// A Dialogflow agent is a virtual agent that handles conversations with your +// end-users. It is a natural language understanding module that understands the +// nuances of human language. Dialogflow translates end-user text or audio +// during a conversation to structured data that your apps and services can +// understand. You design and build a Dialogflow agent to handle the types of +// conversations required for your system. +// +// For more information about agents, see the +// [Agent guide](https://cloud.google.com/dialogflow/docs/agents-overview). +// +message Agent { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Agent" + pattern: "projects/{project}/agent" + pattern: "projects/{project}/locations/{location}/agent" + }; + + // Match mode determines how intents are detected from user queries. + enum MatchMode { + // Not specified. + MATCH_MODE_UNSPECIFIED = 0; + + // Best for agents with a small number of examples in intents and/or wide + // use of templates syntax and composite entities. + MATCH_MODE_HYBRID = 1; + + // Can be used for agents with a large number of examples in intents, + // especially the ones using @sys.any or very large custom entities. + MATCH_MODE_ML_ONLY = 2; + } + + // API version for the agent. + enum ApiVersion { + // Not specified. + API_VERSION_UNSPECIFIED = 0; + + // Legacy V1 API. + API_VERSION_V1 = 1; + + // V2 API. + API_VERSION_V2 = 2; + + // V2beta1 API. + API_VERSION_V2_BETA_1 = 3; + } + + // Represents the agent tier. + enum Tier { + // Not specified. This value should never be used. + TIER_UNSPECIFIED = 0; + + // Standard tier. + TIER_STANDARD = 1; + + // Enterprise tier (Essentials). + TIER_ENTERPRISE = 2; + + // Enterprise tier (Plus). + TIER_ENTERPRISE_PLUS = 3; + } + + // Required. The project of this agent. + // Format: `projects/` or + // `projects//locations/` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The name of this agent. + string display_name = 2; + + // Required. The default language of the agent as a language tag. See + // [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. This field cannot be + // set by the `Update` method. + string default_language_code = 3; + + // Optional. The list of all languages supported by this agent (except for the + // `default_language_code`). + repeated string supported_language_codes = 4; + + // Required. The time zone of this agent from the + // [time zone database](https://www.iana.org/time-zones), e.g., + // America/New_York, Europe/Paris. + string time_zone = 5; + + // Optional. The description of this agent. + // The maximum length is 500 characters. If exceeded, the request is rejected. + string description = 6; + + // Optional. The URI of the agent's avatar. + // Avatars are used throughout the Dialogflow console and in the self-hosted + // [Web + // Demo](https://cloud.google.com/dialogflow/docs/integrations/web-demo) + // integration. + string avatar_uri = 7; + + // Optional. Determines whether this agent should log conversation queries. + bool enable_logging = 8; + + // Optional. Determines how intents are detected from user queries. + MatchMode match_mode = 9 [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 + // learning classification threshold. If the returned score value is less than + // the threshold value, then a fallback intent will be triggered or, if there + // are no fallback intents defined, no intent will be triggered. The score + // values range from 0.0 (completely uncertain) to 1.0 (completely certain). + // If set to 0.0, the default of 0.3 is used. + float classification_threshold = 10; + + // Optional. API version displayed in Dialogflow console. If not specified, + // V2 API is assumed. Clients are free to query different service endpoints + // for different API versions. However, bots connectors and webhook calls will + // follow the specified API version. + ApiVersion api_version = 14; + + // Optional. The agent tier. If not specified, TIER_STANDARD is assumed. + Tier tier = 15; +} + +// The request message for [Agents.GetAgent][google.cloud.dialogflow.v2beta1.Agents.GetAgent]. +message GetAgentRequest { + // Required. The project that the agent to fetch is associated with. + // Format: `projects/` or + // `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; +} + +// The request message for [Agents.SetAgent][google.cloud.dialogflow.v2beta1.Agents.SetAgent]. +message SetAgentRequest { + // Required. The agent to update. + Agent agent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2; +} + +// The request message for [Agents.DeleteAgent][google.cloud.dialogflow.v2beta1.Agents.DeleteAgent]. +message DeleteAgentRequest { + // Required. The project that the agent to delete is associated with. + // Format: `projects/` or + // `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; +} + +// Contains basic configuration for a sub-agent. +message SubAgent { + // Required. The project of this agent. + // Format: `projects/` or + // `projects//locations/`. + string project = 1; + + // Optional. The unique identifier (`environment name` in dialogflow console) + // of this sub-agent environment. Assumes draft environment if `environment` + // is not set. + string environment = 2; +} + +// The request message for [Agents.SearchAgents][google.cloud.dialogflow.v2beta1.Agents.SearchAgents]. +message SearchAgentsRequest { + // Required. The project to list agents from. + // Format: `projects/` or + // `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// The response message for [Agents.SearchAgents][google.cloud.dialogflow.v2beta1.Agents.SearchAgents]. +message SearchAgentsResponse { + // The list of agents. There will be a maximum number of items returned based + // on the page_size field in the request. + repeated Agent agents = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [Agents.TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent]. +message TrainAgentRequest { + // Required. The project that the agent to train is associated with. + // Format: `projects/` or + // `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; +} + +// The request message for [Agents.ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent]. +message ExportAgentRequest { + // Required. The project that the agent to export is associated with. + // Format: `projects/` or + // `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Optional. The + // [Google Cloud Storage](https://cloud.google.com/storage/docs/) + // URI to export the agent to. + // The format of this URI must be `gs:///`. + // If left unspecified, the serialized agent is returned inline. + string agent_uri = 2; +} + +// The response message for [Agents.ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent]. +message ExportAgentResponse { + // The exported agent. + oneof agent { + // The URI to a file containing the exported agent. This field is populated + // only if `agent_uri` is specified in `ExportAgentRequest`. + string agent_uri = 1; + + // Zip compressed raw byte content for agent. + bytes agent_content = 2; + } +} + +// The request message for [Agents.ImportAgent][google.cloud.dialogflow.v2beta1.Agents.ImportAgent]. +message ImportAgentRequest { + // Required. The project that the agent to import is associated with. + // Format: `projects/` or + // `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Required. The agent to import. + oneof agent { + // The URI to a Google Cloud Storage file containing the agent to import. + // Note: The URI must start with "gs://". + string agent_uri = 2; + + // Zip compressed raw byte content for agent. + bytes agent_content = 3; + } +} + +// The request message for [Agents.RestoreAgent][google.cloud.dialogflow.v2beta1.Agents.RestoreAgent]. +message RestoreAgentRequest { + // Required. The project that the agent to restore is associated with. + // Format: `projects/` or + // `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Required. The agent to restore. + oneof agent { + // The URI to a Google Cloud Storage file containing the agent to restore. + // Note: The URI must start with "gs://". + string agent_uri = 2; + + // Zip compressed raw byte content for agent. + bytes agent_content = 3; + } +} + +// The request message for [Agents.GetValidationResult][google.cloud.dialogflow.v2beta1.Agents.GetValidationResult]. +message GetValidationResultRequest { + // Required. The project that the agent is associated with. + // Format: `projects/` or + // `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Optional. The language for which you want a validation result. If not + // specified, the agent's default language is used. [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. Note: languages must be enabled in the agent before they can + // be used. + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/answer_record.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/answer_record.proto new file mode 100644 index 00000000..fd7d5312 --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/answer_record.proto @@ -0,0 +1,317 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2beta1/participant.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "AnswerRecordsProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [AnswerRecords][google.cloud.dialogflow.v2beta1.AnswerRecord]. +service AnswerRecords { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Deprecated. + // Retrieves a specific answer record. + rpc GetAnswerRecord(GetAnswerRecordRequest) returns (AnswerRecord) { + option deprecated = true; + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/answerRecords/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/answerRecords/*}" + } + }; + } + + // Returns the list of all answer records in the specified project in reverse + // chronological order. + rpc ListAnswerRecords(ListAnswerRecordsRequest) returns (ListAnswerRecordsResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*}/answerRecords" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*}/answerRecords" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Updates the specified answer record. + rpc UpdateAnswerRecord(UpdateAnswerRecordRequest) returns (AnswerRecord) { + option (google.api.http) = { + patch: "/v2beta1/{answer_record.name=projects/*/answerRecords/*}" + body: "answer_record" + additional_bindings { + patch: "/v2beta1/{answer_record.name=projects/*/locations/*/answerRecords/*}" + body: "answer_record" + } + }; + option (google.api.method_signature) = "answer_record,update_mask"; + } +} + +// Answer records are records to manage answer history and feedbacks for +// Dialogflow. +// +// Currently, answer record includes: +// +// - human agent assistant article suggestion +// - human agent assistant faq article +// +// It doesn't include: +// +// - `DetectIntent` intent matching +// - `DetectIntent` knowledge +// +// Answer records are not related to the conversation history in the +// Dialogflow Console. A Record is generated even when the end-user disables +// conversation history in the console. Records are created when there's a human +// agent assistant suggestion generated. +// +// A typical workflow for customers provide feedback to an answer is: +// +// 1. For human agent assistant, customers get suggestion via ListSuggestions +// API. Together with the answers, [AnswerRecord.name][google.cloud.dialogflow.v2beta1.AnswerRecord.name] are returned to the +// customers. +// 2. The customer uses the [AnswerRecord.name][google.cloud.dialogflow.v2beta1.AnswerRecord.name] to call the +// [UpdateAnswerRecord][] method to send feedback about a specific answer +// that they believe is wrong. +message AnswerRecord { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/AnswerRecord" + pattern: "projects/{project}/answerRecords/{answer_record}" + pattern: "projects/{project}/locations/{location}/answerRecords/{answer_record}" + }; + + // The unique identifier of this answer record. + // Required for [AnswerRecords.UpdateAnswerRecord][google.cloud.dialogflow.v2beta1.AnswerRecords.UpdateAnswerRecord] method. + // Format: `projects//locations//answerRecords/`. + string name = 1; + + // Optional. The AnswerFeedback for this record. You can set this with + // [AnswerRecords.UpdateAnswerRecord][google.cloud.dialogflow.v2beta1.AnswerRecords.UpdateAnswerRecord] in order to give us feedback about + // this answer. + AnswerFeedback answer_feedback = 3; + + // Output only. The record for this answer. + oneof record { + // Output only. The record for human agent assistant. + AgentAssistantRecord agent_assistant_record = 4; + } +} + +// Represents a record of a human agent assistant answer. +message AgentAssistantRecord { + // Output only. The agent assistant answer. + oneof answer { + // Output only. The article suggestion answer. + ArticleAnswer article_suggestion_answer = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The FAQ answer. + FaqAnswer faq_answer = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + } +} + +// Represents feedback the customer has about the quality & correctness of a +// certain answer in a conversation. +message AnswerFeedback { + // The correctness level of an answer. + enum CorrectnessLevel { + // Correctness level unspecified. + CORRECTNESS_LEVEL_UNSPECIFIED = 0; + + // Answer is totally wrong. + NOT_CORRECT = 1; + + // Answer is partially correct. + PARTIALLY_CORRECT = 2; + + // Answer is fully correct. + FULLY_CORRECT = 3; + } + + // The correctness level of the specific answer. + CorrectnessLevel correctness_level = 1; + + // Normally, detail feedback is provided when answer is not fully correct. + oneof detail_feedback { + // Optional. Detail feedback of agent assistant suggestions. + AgentAssistantFeedback agent_assistant_detail_feedback = 2; + } + + // Indicates whether the answer/item was clicked by the human agent + // or not. Default to false. + bool clicked = 3; + + // Time when the answer/item was clicked. + google.protobuf.Timestamp click_time = 5; + + // Indicates whether the answer/item was displayed to the human + // agent in the agent desktop UI. Default to false. + bool displayed = 4; + + // Time when the answer/item was displayed. + google.protobuf.Timestamp display_time = 6; +} + +// Detail feedback of Agent Assistant result. +message AgentAssistantFeedback { + // Feedback for conversation summarization. + message SummarizationFeedback { + // Timestamp when composing of the summary starts. + google.protobuf.Timestamp start_timestamp = 1; + + // Timestamp when the summary was submitted. + google.protobuf.Timestamp submit_timestamp = 2; + + // Text of actual submitted summary. + string summary_text = 3; + } + + // Relevance of an answer. + enum AnswerRelevance { + // Answer relevance unspecified. + ANSWER_RELEVANCE_UNSPECIFIED = 0; + + // Answer is irrelevant to query. + IRRELEVANT = 1; + + // Answer is relevant to query. + RELEVANT = 2; + } + + // Correctness of document. + enum DocumentCorrectness { + // Document correctness unspecified. + DOCUMENT_CORRECTNESS_UNSPECIFIED = 0; + + // Information in document is incorrect. + INCORRECT = 1; + + // Information in document is correct. + CORRECT = 2; + } + + // Efficiency of document. + enum DocumentEfficiency { + // Document efficiency unspecified. + DOCUMENT_EFFICIENCY_UNSPECIFIED = 0; + + // Document is inefficient. + INEFFICIENT = 1; + + // Document is efficient. + EFFICIENT = 2; + } + + // Optional. Whether or not the suggested answer is relevant. + // + // For example: + // + // * Query: "Can I change my mailing address?" + // * Suggested document says: "Items must be returned/exchanged within 60 + // days of the purchase date." + // * [answer_relevance][google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.answer_relevance]: [AnswerRelevance.IRRELEVANT][google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.AnswerRelevance.IRRELEVANT] + AnswerRelevance answer_relevance = 1; + + // Optional. Whether or not the information in the document is correct. + // + // For example: + // + // * Query: "Can I return the package in 2 days once received?" + // * Suggested document says: "Items must be returned/exchanged within 60 + // days of the purchase date." + // * Ground truth: "No return or exchange is allowed." + // * [document_correctness]: INCORRECT + DocumentCorrectness document_correctness = 2; + + // Optional. Whether or not the suggested document is efficient. For example, + // if the document is poorly written, hard to understand, hard to use or + // too long to find useful information, [document_efficiency][google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.document_efficiency] is + // [DocumentEfficiency.INEFFICIENT][google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentEfficiency.INEFFICIENT]. + DocumentEfficiency document_efficiency = 3; + + // Feedback for conversation summarization. + SummarizationFeedback summarization_feedback = 4; +} + +// Request message for [AnswerRecords.GetAnswerRecord][google.cloud.dialogflow.v2beta1.AnswerRecords.GetAnswerRecord]. +message GetAnswerRecordRequest { + // Required. The name of the answer record to retrieve. + // Format: `projects//locations//answerRecords/`. + string name = 1; +} + +// Request message for [AnswerRecords.ListAnswerRecords][google.cloud.dialogflow.v2beta1.AnswerRecords.ListAnswerRecords]. +message ListAnswerRecordsRequest { + // Required. The project to list all answer records for in reverse + // chronological order. Format: `projects//locations/`. + string parent = 1 [(google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/AnswerRecord" + }]; + + // Optional. The maximum number of records to return in a single page. + // The server may return fewer records than this. If unspecified, we use 10. + // The maximum is 100. + int32 page_size = 3; + + // Optional. The + // [ListAnswerRecordsResponse.next_page_token][google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse.next_page_token] + // value returned from a previous list request used to continue listing on + // the next page. + string page_token = 4; +} + +// Response message for [AnswerRecords.ListAnswerRecords][google.cloud.dialogflow.v2beta1.AnswerRecords.ListAnswerRecords]. +message ListAnswerRecordsResponse { + // The list of answer records. + repeated AnswerRecord answer_records = 1; + + // A token to retrieve next page of results. Or empty if there are no more + // results. + // Pass this value in the + // [ListAnswerRecordsRequest.page_token][google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest.page_token] + // field in the subsequent call to `ListAnswerRecords` method to retrieve the + // next page of results. + string next_page_token = 2; +} + +// Request message for [AnswerRecords.UpdateAnswerRecord][google.cloud.dialogflow.v2beta1.AnswerRecords.UpdateAnswerRecord]. +message UpdateAnswerRecordRequest { + // Required. Answer record to update. + AnswerRecord answer_record = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2; +} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/audio_config.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/audio_config.proto new file mode 100644 index 00000000..45b1c2b7 --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/audio_config.proto @@ -0,0 +1,437 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "AudioConfigProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Audio encoding of the audio content sent in the conversational query request. +// Refer to the +// [Cloud Speech API +// documentation](https://cloud.google.com/speech-to-text/docs/basics) for more +// details. +enum AudioEncoding { + // Not specified. + AUDIO_ENCODING_UNSPECIFIED = 0; + + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + AUDIO_ENCODING_LINEAR_16 = 1; + + // [`FLAC`](https://xiph.org/flac/documentation.html) (Free Lossless Audio + // Codec) is the recommended encoding because it is lossless (therefore + // recognition is not compromised) and requires only about half the + // bandwidth of `LINEAR16`. `FLAC` stream encoding supports 16-bit and + // 24-bit samples, however, not all fields in `STREAMINFO` are supported. + AUDIO_ENCODING_FLAC = 2; + + // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + AUDIO_ENCODING_MULAW = 3; + + // Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000. + AUDIO_ENCODING_AMR = 4; + + // Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000. + AUDIO_ENCODING_AMR_WB = 5; + + // Opus encoded audio frames in Ogg container + // ([OggOpus](https://wiki.xiph.org/OggOpus)). + // `sample_rate_hertz` must be 16000. + AUDIO_ENCODING_OGG_OPUS = 6; + + // Although the use of lossy encodings is not recommended, if a very low + // bitrate encoding is required, `OGG_OPUS` is highly preferred over + // Speex encoding. The [Speex](https://speex.org/) encoding supported by + // Dialogflow API has a header byte in each block, as in MIME type + // `audio/x-speex-with-header-byte`. + // It is a variant of the RTP Speex encoding defined in + // [RFC 5574](https://tools.ietf.org/html/rfc5574). + // The stream is a sequence of blocks, one block per RTP packet. Each block + // starts with a byte containing the length of the block, in bytes, followed + // by one or more frames of Speex data, padded to an integral number of + // bytes (octets) as specified in RFC 5574. In other words, each RTP header + // is replaced with a single byte containing the block length. Only Speex + // wideband is supported. `sample_rate_hertz` must be 16000. + AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7; +} + +// 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. + string word = 3; + + // Time offset relative to the beginning of the audio that corresponds to the + // start of the spoken word. This is an experimental feature and the accuracy + // of the time offset can vary. + google.protobuf.Duration start_offset = 1; + + // Time offset relative to the beginning of the audio that corresponds to the + // end of the spoken word. This is an experimental feature and the accuracy of + // the time offset can vary. + google.protobuf.Duration end_offset = 2; + + // The Speech confidence between 0.0 and 1.0 for this word. A higher number + // indicates an estimated greater likelihood that the recognized word is + // correct. The default of 0.0 is a sentinel value indicating that confidence + // was not set. + // + // This field is not guaranteed to be fully stable over time for the same + // audio input. Users should also not rely on it to always be provided. + float confidence = 4; +} + +// Variant of the specified [Speech model][google.cloud.dialogflow.v2beta1.InputAudioConfig.model] to use. +// +// See the [Cloud Speech +// documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) +// for which models have different variants. For example, the "phone_call" model +// has both a standard and an enhanced variant. When you use an enhanced model, +// you will generally receive higher quality results than for a standard model. +enum SpeechModelVariant { + // No model variant specified. In this case Dialogflow defaults to + // USE_BEST_AVAILABLE. + SPEECH_MODEL_VARIANT_UNSPECIFIED = 0; + + // Use the best available variant of the [Speech + // model][InputAudioConfig.model] that the caller is eligible for. + // + // Please see the [Dialogflow + // docs](https://cloud.google.com/dialogflow/docs/data-logging) for + // how to make your project eligible for enhanced models. + USE_BEST_AVAILABLE = 1; + + // Use standard model variant even if an enhanced model is available. See the + // [Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) + // for details about enhanced models. + USE_STANDARD = 2; + + // Use an enhanced model variant: + // + // * If an enhanced variant does not exist for the given + // [model][google.cloud.dialogflow.v2beta1.InputAudioConfig.model] and request language, Dialogflow falls + // back to the standard variant. + // + // The [Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) + // describes which models have enhanced variants. + // + // * If the API caller isn't eligible for enhanced models, Dialogflow returns + // an error. Please see the [Dialogflow + // docs](https://cloud.google.com/dialogflow/docs/data-logging) + // for how to make your project eligible. + USE_ENHANCED = 3; +} + +// Instructs the speech recognizer on how to process the audio content. +message InputAudioConfig { + // Required. Audio encoding of the audio content to process. + AudioEncoding audio_encoding = 1; + + // Required. Sample rate (in Hertz) of the audio content sent in the query. + // Refer to + // [Cloud Speech API + // documentation](https://cloud.google.com/speech-to-text/docs/basics) for + // more details. + int32 sample_rate_hertz = 2; + + // Required. The language of the supplied audio. Dialogflow does not do + // translations. See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. Note that queries in + // the same session do not necessarily need to specify the same language. + string language_code = 3; + + // If `true`, Dialogflow returns [SpeechWordInfo][google.cloud.dialogflow.v2beta1.SpeechWordInfo] in + // [StreamingRecognitionResult][google.cloud.dialogflow.v2beta1.StreamingRecognitionResult] with information about the recognized speech + // words, e.g. start and end time offsets. If false or unspecified, Speech + // doesn't return any word-level information. + bool enable_word_info = 13; + + // A list of strings containing words and phrases that the speech + // recognizer should recognize with higher likelihood. + // + // See [the Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) + // for more details. + // + // This field is deprecated. Please use [speech_contexts]() instead. If you + // specify both [phrase_hints]() and [speech_contexts](), Dialogflow will + // treat the [phrase_hints]() as a single additional [SpeechContext](). + repeated string phrase_hints = 4 [deprecated = true]; + + // Context information to assist speech recognition. + // + // See [the Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) + // for more details. + repeated SpeechContext speech_contexts = 11; + + // Which Speech model to select for the given request. Select the + // model best suited to your domain to get best results. If a model is not + // explicitly specified, then we auto-select a model based on the parameters + // in the InputAudioConfig. + // If enhanced speech model is enabled for the agent and an enhanced + // version of the specified model for the language does not exist, then the + // speech is recognized using the standard version of the specified model. + // Refer to + // [Cloud Speech API + // documentation](https://cloud.google.com/speech-to-text/docs/basics#select-model) + // for more details. + string model = 7; + + // Which variant of the [Speech model][google.cloud.dialogflow.v2beta1.InputAudioConfig.model] to use. + SpeechModelVariant model_variant = 10; + + // If `false` (default), recognition does not cease until the + // client closes the stream. + // If `true`, the recognizer will detect a single spoken utterance in input + // audio. Recognition ceases when it detects the audio's voice has + // stopped or paused. In this case, once a detected intent is received, the + // client should close the stream and start a new request with a new stream as + // needed. + // Note: This setting is relevant only for streaming methods. + // Note: When specified, InputAudioConfig.single_utterance takes precedence + // over StreamingDetectIntentRequest.single_utterance. + bool single_utterance = 8; + + // Only used in [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] and + // [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent]. + // If `false` and recognition doesn't return any result, trigger + // `NO_SPEECH_RECOGNIZED` event to Dialogflow agent. + bool disable_no_speech_recognized_event = 14; +} + +// Description of which voice to use for speech synthesis. +message VoiceSelectionParams { + // Optional. The name of the voice. If not set, the service will choose a + // voice based on the other parameters such as language_code and + // [ssml_gender][google.cloud.dialogflow.v2beta1.VoiceSelectionParams.ssml_gender]. + // + // For the list of available voices, please refer to [Supported voices and + // languages](https://cloud.google.com/text-to-speech/docs/voices). + string name = 1; + + // Optional. The preferred gender of the voice. If not set, the service will + // choose a voice based on the other parameters such as language_code and + // [name][google.cloud.dialogflow.v2beta1.VoiceSelectionParams.name]. Note that this is only a preference, not requirement. If a + // voice of the appropriate gender is not available, the synthesizer should + // substitute a voice with a different gender rather than failing the request. + SsmlVoiceGender ssml_gender = 2; +} + +// Configuration of how speech should be synthesized. +message SynthesizeSpeechConfig { + // Optional. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is the normal + // native speed supported by the specific voice. 2.0 is twice as fast, and + // 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any + // other values < 0.25 or > 4.0 will return an error. + double speaking_rate = 1; + + // Optional. Speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20 + // semitones from the original pitch. -20 means decrease 20 semitones from the + // original pitch. + double pitch = 2; + + // Optional. Volume gain (in dB) of the normal native volume supported by the + // specific voice, in the range [-96.0, 16.0]. If unset, or set to a value of + // 0.0 (dB), will play at normal native signal amplitude. A value of -6.0 (dB) + // will play at approximately half the amplitude of the normal native signal + // amplitude. A value of +6.0 (dB) will play at approximately twice the + // amplitude of the normal native signal amplitude. We strongly recommend not + // to exceed +10 (dB) as there's usually no effective increase in loudness for + // any value greater than that. + double volume_gain_db = 3; + + // Optional. An identifier which selects 'audio effects' profiles that are + // applied on (post synthesized) text to speech. Effects are applied on top of + // each other in the order they are given. + repeated string effects_profile_id = 5; + + // Optional. The desired voice of the synthesized audio. + VoiceSelectionParams voice = 4; +} + +// Gender of the voice as described in +// [SSML voice element](https://www.w3.org/TR/speech-synthesis11/#edef_voice). +enum SsmlVoiceGender { + // An unspecified gender, which means that the client doesn't care which + // gender the selected voice will have. + SSML_VOICE_GENDER_UNSPECIFIED = 0; + + // A male voice. + SSML_VOICE_GENDER_MALE = 1; + + // A female voice. + SSML_VOICE_GENDER_FEMALE = 2; + + // A gender-neutral voice. + SSML_VOICE_GENDER_NEUTRAL = 3; +} + +// Instructs the speech synthesizer how to generate the output audio content. +// If this audio config is supplied in a request, it overrides all existing +// text-to-speech settings applied to the agent. +message OutputAudioConfig { + // Required. Audio encoding of the synthesized audio content. + OutputAudioEncoding audio_encoding = 1 [(google.api.field_behavior) = REQUIRED]; + + // The synthesis sample rate (in hertz) for this audio. If not + // provided, then the synthesizer will use the default sample rate based on + // the audio encoding. If this is different from the voice's natural sample + // rate, then the synthesizer will honor this request by converting to the + // desired sample rate (which might result in worse audio quality). + int32 sample_rate_hertz = 2; + + // Configuration of how speech should be synthesized. + SynthesizeSpeechConfig synthesize_speech_config = 3; +} + +// A wrapper of repeated TelephonyDtmf digits. +message TelephonyDtmfEvents { + // A sequence of TelephonyDtmf digits. + repeated TelephonyDtmf dtmf_events = 1; +} + +// Audio encoding of the output audio format in Text-To-Speech. +enum OutputAudioEncoding { + // Not specified. + OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0; + + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + // Audio content returned as LINEAR16 also contains a WAV header. + OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1; + + // MP3 audio at 32kbps. + OUTPUT_AUDIO_ENCODING_MP3 = 2; + + // MP3 audio at 64kbps. + OUTPUT_AUDIO_ENCODING_MP3_64_KBPS = 4; + + // Opus encoded audio wrapped in an ogg container. The result will be a + // file which can be played natively on Android, and in browsers (at least + // Chrome and Firefox). The quality of the encoding is considerably higher + // than MP3 while using approximately the same bitrate. + OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3; + + // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + OUTPUT_AUDIO_ENCODING_MULAW = 5; +} + +// Configures speech transcription for [ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile]. +message SpeechToTextConfig { + // Optional. The speech model used in speech to text. + // `SPEECH_MODEL_VARIANT_UNSPECIFIED`, `USE_BEST_AVAILABLE` will be treated as + // `USE_ENHANCED`. It can be overridden in [AnalyzeContentRequest][google.cloud.dialogflow.v2beta1.AnalyzeContentRequest] and + // [StreamingAnalyzeContentRequest][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest] request. + SpeechModelVariant speech_model_variant = 1 [(google.api.field_behavior) = OPTIONAL]; +} + +// [DTMF](https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling) +// digit in Telephony Gateway. +enum TelephonyDtmf { + // Not specified. This value may be used to indicate an absent digit. + TELEPHONY_DTMF_UNSPECIFIED = 0; + + // Number: '1'. + DTMF_ONE = 1; + + // Number: '2'. + DTMF_TWO = 2; + + // Number: '3'. + DTMF_THREE = 3; + + // Number: '4'. + DTMF_FOUR = 4; + + // Number: '5'. + DTMF_FIVE = 5; + + // Number: '6'. + DTMF_SIX = 6; + + // Number: '7'. + DTMF_SEVEN = 7; + + // Number: '8'. + DTMF_EIGHT = 8; + + // Number: '9'. + DTMF_NINE = 9; + + // Number: '0'. + DTMF_ZERO = 10; + + // Letter: 'A'. + DTMF_A = 11; + + // Letter: 'B'. + DTMF_B = 12; + + // Letter: 'C'. + DTMF_C = 13; + + // Letter: 'D'. + DTMF_D = 14; + + // Asterisk/star: '*'. + DTMF_STAR = 15; + + // Pound/diamond/hash/square/gate/octothorpe: '#'. + DTMF_POUND = 16; +} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/context.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/context.proto new file mode 100644 index 00000000..c18e411a --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/context.proto @@ -0,0 +1,375 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ContextProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Contexts][google.cloud.dialogflow.v2beta1.Context]. +service Contexts { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all contexts in the specified session. + rpc ListContexts(ListContextsRequest) returns (ListContextsResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts" + additional_bindings { + get: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" + } + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/contexts" + } + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified context. + rpc GetContext(GetContextRequest) returns (Context) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/agent/sessions/*/contexts/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" + } + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/agent/sessions/*/contexts/*}" + } + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a context. + // + // If the specified context already exists, overrides the context. + rpc CreateContext(CreateContextRequest) returns (Context) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts" + body: "context" + additional_bindings { + post: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" + body: "context" + } + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/contexts" + body: "context" + } + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" + body: "context" + } + }; + option (google.api.method_signature) = "parent,context"; + } + + // Updates the specified context. + rpc UpdateContext(UpdateContextRequest) returns (Context) { + option (google.api.http) = { + patch: "/v2beta1/{context.name=projects/*/agent/sessions/*/contexts/*}" + body: "context" + additional_bindings { + patch: "/v2beta1/{context.name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" + body: "context" + } + additional_bindings { + patch: "/v2beta1/{context.name=projects/*/locations/*/agent/sessions/*/contexts/*}" + body: "context" + } + additional_bindings { + patch: "/v2beta1/{context.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" + body: "context" + } + }; + option (google.api.method_signature) = "context,update_mask"; + option (google.api.method_signature) = "context"; + } + + // Deletes the specified context. + rpc DeleteContext(DeleteContextRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta1/{name=projects/*/agent/sessions/*/contexts/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" + } + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/agent/sessions/*/contexts/*}" + } + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Deletes all active contexts in the specified session. + rpc DeleteAllContexts(DeleteAllContextsRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts" + additional_bindings { + delete: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" + } + additional_bindings { + delete: "/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/contexts" + } + additional_bindings { + delete: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" + } + }; + option (google.api.method_signature) = "parent"; + } +} + +// Dialogflow contexts are similar to natural language context. If a person says +// to you "they are orange", you need context in order to understand what "they" +// is referring to. Similarly, for Dialogflow to handle an end-user expression +// like that, it needs to be provided with context in order to correctly match +// an intent. +// +// Using contexts, you can control the flow of a conversation. You can configure +// contexts for an intent by setting input and output contexts, which are +// identified by string names. When an intent is matched, any configured output +// contexts for that intent become active. While any contexts are active, +// Dialogflow is more likely to match intents that are configured with input +// contexts that correspond to the currently active contexts. +// +// For more information about context, see the +// [Contexts guide](https://cloud.google.com/dialogflow/docs/contexts-overview). +message Context { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Context" + pattern: "projects/{project}/agent/sessions/{session}/contexts/{context}" + pattern: "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}" + pattern: "projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}" + pattern: "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}" + }; + + // Required. The unique identifier of the context. Supported formats: + // - `projects//agent/sessions//contexts/`, + // - `projects//locations//agent/sessions//contexts/`, + // - `projects//agent/environments//users//sessions//contexts/`, + // - `projects//locations//agent/environments//users//sessions//contexts/`, + // + // The `Context ID` is always converted to lowercase, may only contain + // characters in a-zA-Z0-9_-% and may be at most 250 bytes long. + // + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + // + // The following context names are reserved for internal use by Dialogflow. + // You should not use these contexts or create contexts with these names: + // + // * `__system_counters__` + // * `*_id_dialog_context` + // * `*_dialog_params_size` + string name = 1; + + // Optional. The number of conversational query requests after which the + // context expires. The default is `0`. If set to `0`, the context expires + // immediately. Contexts expire automatically after 20 minutes if there + // are no matching queries. + int32 lifespan_count = 2; + + // Optional. The collection of parameters associated with this context. + // + // Depending on your protocol or client library language, this is a + // map, associative array, symbol table, dictionary, or JSON object + // composed of a collection of (MapKey, MapValue) pairs: + // + // - MapKey type: string + // - MapKey value: parameter name + // - MapValue type: + // - If parameter's entity type is a composite entity: map + // - Else: depending on parameter value type, could be one of string, + // number, boolean, null, list or map + // - MapValue value: + // - If parameter's entity type is a composite entity: + // map from composite entity property names to property values + // - Else: parameter value + google.protobuf.Struct parameters = 3; +} + +// The request message for [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts]. +message ListContextsRequest { + // Required. The session to list all contexts from. Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Context" + } + ]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// The response message for [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts]. +message ListContextsResponse { + // The list of contexts. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Context contexts = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [Contexts.GetContext][google.cloud.dialogflow.v2beta1.Contexts.GetContext]. +message GetContextRequest { + // Required. The name of the context. Supported formats: + // - `projects//agent/sessions//contexts/`, + // - `projects//locations//agent/sessions//contexts/`, + // - `projects//agent/environments//users//sessions//contexts/`, + // - `projects//locations//agent/environments//users//sessions//contexts/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Context" + } + ]; +} + +// The request message for [Contexts.CreateContext][google.cloud.dialogflow.v2beta1.Contexts.CreateContext]. +message CreateContextRequest { + // Required. The session to create a context for. Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Context" + } + ]; + + // Required. The context to create. + Context context = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Contexts.UpdateContext][google.cloud.dialogflow.v2beta1.Contexts.UpdateContext]. +message UpdateContextRequest { + // Required. The context to update. + Context context = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Contexts.DeleteContext][google.cloud.dialogflow.v2beta1.Contexts.DeleteContext]. +message DeleteContextRequest { + // Required. The name of the context to delete. Supported formats: + // - `projects//agent/sessions//contexts/`, + // - `projects//locations//agent/sessions//contexts/`, + // - `projects//agent/environments//users//sessions//contexts/`, + // - `projects//locations//agent/environments//users//sessions//contexts/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Context" + } + ]; +} + +// The request message for [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContexts]. +message DeleteAllContextsRequest { + // Required. The name of the session to delete all contexts from. Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified we assume default 'draft' environment. If + // `User ID` is not specified, we assume default '-' user. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Context" + } + ]; +} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation.proto new file mode 100644 index 00000000..6c2fdf6d --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation.proto @@ -0,0 +1,419 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2beta1/gcs.proto"; +import "google/cloud/dialogflow/v2beta1/participant.proto"; +import "google/cloud/dialogflow/v2beta1/session.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ConversationProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Conversations][google.cloud.dialogflow.v2beta1.Conversation]. +service Conversations { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Creates a new conversation. Conversations are auto-completed after 24 + // hours. + // + // Conversation Lifecycle: + // There are two stages during a conversation: Automated Agent Stage and + // Assist Stage. + // + // For Automated Agent Stage, there will be a dialogflow agent responding to + // user queries. + // + // For Assist Stage, there's no dialogflow agent responding to user queries. + // But we will provide suggestions which are generated from conversation. + // + // If [Conversation.conversation_profile][google.cloud.dialogflow.v2beta1.Conversation.conversation_profile] is configured for a dialogflow + // agent, conversation will start from `Automated Agent Stage`, otherwise, it + // will start from `Assist Stage`. And during `Automated Agent Stage`, once an + // [Intent][google.cloud.dialogflow.v2beta1.Intent] with [Intent.live_agent_handoff][google.cloud.dialogflow.v2beta1.Intent.live_agent_handoff] is triggered, conversation + // will transfer to Assist Stage. + rpc CreateConversation(CreateConversationRequest) returns (Conversation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*}/conversations" + body: "conversation" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*}/conversations" + body: "conversation" + } + }; + option (google.api.method_signature) = "parent,conversation"; + } + + // Returns the list of all conversations in the specified project. + rpc ListConversations(ListConversationsRequest) returns (ListConversationsResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*}/conversations" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*}/conversations" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specific conversation. + rpc GetConversation(GetConversationRequest) returns (Conversation) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/conversations/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/conversations/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Completes the specified conversation. Finished conversations are purged + // from the database after 30 days. + rpc CompleteConversation(CompleteConversationRequest) returns (Conversation) { + option (google.api.http) = { + post: "/v2beta1/{name=projects/*/conversations/*}:complete" + body: "*" + additional_bindings { + post: "/v2beta1/{name=projects/*/locations/*/conversations/*}:complete" + body: "*" + } + }; + option (google.api.method_signature) = "name"; + } + + // Batch ingests messages to conversation. Customers can use this RPC to + // ingest historical messages to conversation. + rpc BatchCreateMessages(BatchCreateMessagesRequest) returns (BatchCreateMessagesResponse) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/conversations/*}/messages:batchCreate" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/conversations/*}/messages:batchCreate" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Lists messages that belong to a given conversation. + // `messages` are ordered by `create_time` in descending order. To fetch + // updates without duplication, send request with filter + // `create_time_epoch_microseconds > + // [first item's create_time of previous request]` and empty page_token. + rpc ListMessages(ListMessagesRequest) returns (ListMessagesResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/conversations/*}/messages" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/conversations/*}/messages" + } + }; + option (google.api.method_signature) = "parent"; + } +} + +// Represents a conversation. +// A conversation is an interaction between an agent, including live agents +// and Dialogflow agents, and a support customer. Conversations can +// include phone calls and text-based chat sessions. +message Conversation { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Conversation" + pattern: "projects/{project}/conversations/{conversation}" + pattern: "projects/{project}/locations/{location}/conversations/{conversation}" + }; + + // Enumeration of the completion status of the conversation. + enum LifecycleState { + // Unknown. + LIFECYCLE_STATE_UNSPECIFIED = 0; + + // Conversation is currently open for media analysis. + IN_PROGRESS = 1; + + // Conversation has been completed. + COMPLETED = 2; + } + + // Enumeration of the different conversation stages a conversation can be in. + // Reference: + // https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages + enum ConversationStage { + // Unknown. Should never be used after a conversation is successfully + // created. + CONVERSATION_STAGE_UNSPECIFIED = 0; + + // The conversation should return virtual agent responses into the + // conversation. + VIRTUAL_AGENT_STAGE = 1; + + // The conversation should not provide responses, just listen and provide + // suggestions. + HUMAN_ASSIST_STAGE = 2; + } + + // Output only. The unique identifier of this conversation. + // Format: `projects//locations//conversations/`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the Conversation. + LifecycleState lifecycle_state = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The Conversation Profile to be used to configure this + // Conversation. This field cannot be updated. + // Format: `projects//locations//conversationProfiles/`. + string conversation_profile = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationProfile" + } + ]; + + // Output only. Required if the conversation is to be connected over + // telephony. + ConversationPhoneNumber phone_number = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The stage of a conversation. It indicates whether the virtual agent or a + // human agent is handling the conversation. + // + // If the conversation is created with the conversation profile that has + // Dialogflow config set, defaults to + // [ConversationStage.VIRTUAL_AGENT_STAGE][google.cloud.dialogflow.v2beta1.Conversation.ConversationStage.VIRTUAL_AGENT_STAGE]; Otherwise, defaults to + // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2beta1.Conversation.ConversationStage.HUMAN_ASSIST_STAGE]. + // + // If the conversation is created with the conversation profile that has + // Dialogflow config set but explicitly sets conversation_stage to + // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2beta1.Conversation.ConversationStage.HUMAN_ASSIST_STAGE], it skips + // [ConversationStage.VIRTUAL_AGENT_STAGE][google.cloud.dialogflow.v2beta1.Conversation.ConversationStage.VIRTUAL_AGENT_STAGE] stage and directly goes to + // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2beta1.Conversation.ConversationStage.HUMAN_ASSIST_STAGE]. + ConversationStage conversation_stage = 7; + + // Output only. The time the conversation was started. + google.protobuf.Timestamp start_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the conversation was finished. + google.protobuf.Timestamp end_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents a phone number for telephony integration. It allows for connecting +// a particular conversation over telephony. +message ConversationPhoneNumber { + // Output only. The phone number to connect to this conversation. + string phone_number = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request message for [Conversations.CreateConversation][google.cloud.dialogflow.v2beta1.Conversations.CreateConversation]. +message CreateConversationRequest { + // Required. Resource identifier of the project creating the conversation. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Conversation" + } + ]; + + // Required. The conversation to create. + Conversation conversation = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Identifier of the conversation. Generally it's auto generated by Google. + // Only set it if you cannot wait for the response to return a + // auto-generated one to you. + // + // The conversation ID must be compliant with the regression fomula + // "[a-zA-Z][a-zA-Z0-9_-]*" with the characters length in range of [3,64]. + // If the field is provided, the caller is resposible for + // 1. the uniqueness of the ID, otherwise the request will be rejected. + // 2. the consistency for whether to use custom ID or not under a project to + // better ensure uniqueness. + string conversation_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Conversations.ListConversations][google.cloud.dialogflow.v2beta1.Conversations.ListConversations]. +message ListConversationsRequest { + // Required. The project from which to list all conversation. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Conversation" + } + ]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3; + + // A filter expression that filters conversations listed in the response. In + // general, the expression must specify the field name, a comparison operator, + // and the value to use for filtering: + //
    + //
  • The value must be a string, a number, or a boolean.
  • + //
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + //
  • To filter on multiple expressions, separate the + // expressions with `AND` or `OR` (omitting both implies `AND`).
  • + //
  • For clarity, expressions can be enclosed in parentheses.
  • + //
+ // Only `lifecycle_state` can be filtered on in this way. For example, + // the following expression only returns `COMPLETED` conversations: + // + // `lifecycle_state = "COMPLETED"` + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 4; +} + +// The response message for [Conversations.ListConversations][google.cloud.dialogflow.v2beta1.Conversations.ListConversations]. +message ListConversationsResponse { + // The list of conversations. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Conversation conversations = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [Conversations.GetConversation][google.cloud.dialogflow.v2beta1.Conversations.GetConversation]. +message GetConversationRequest { + // Required. The name of the conversation. Format: + // `projects//locations//conversations/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Conversation" + } + ]; +} + +// The request message for [Conversations.CompleteConversation][google.cloud.dialogflow.v2beta1.Conversations.CompleteConversation]. +message CompleteConversationRequest { + // Required. Resource identifier of the conversation to close. + // Format: `projects//locations//conversations/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Conversation" + } + ]; +} + +// The request message to create one Message. Currently it is only used in +// BatchCreateMessagesRequest. +message CreateMessageRequest { + // Required. Resource identifier of the conversation to create message. + // Format: `projects//locations//conversations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Conversation" + } + ]; + + // Required. The message to create. + // [Message.participant][google.cloud.dialogflow.v2beta1.Message.participant] is required. + Message message = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Conversations.BatchCreateMessagesRequest][]. +message BatchCreateMessagesRequest { + // Required. Resource identifier of the conversation to create message. + // Format: `projects//locations//conversations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Conversation" + } + ]; + + // Required. A maximum of 1000 Messages can be created in a batch. + // [CreateMessageRequest.message.send_time][] is required. All created + // messages will have identical [Message.create_time][google.cloud.dialogflow.v2beta1.Message.create_time]. + repeated CreateMessageRequest requests = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Conversations.BatchCreateMessagesResponse][]. +message BatchCreateMessagesResponse { + // Messages created. + repeated Message messages = 1; +} + +// The request message for [Conversations.ListMessages][google.cloud.dialogflow.v2beta1.Conversations.ListMessages]. +message ListMessagesRequest { + // Required. The name of the conversation to list messages for. + // Format: `projects//locations//conversations/` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Message" + } + ]; + + // Optional. Filter on message fields. Currently predicates on `create_time` + // and `create_time_epoch_microseconds` are supported. `create_time` only + // support milliseconds accuracy. E.g., + // `create_time_epoch_microseconds > 1551790877964485` or + // `create_time > "2017-01-15T01:30:15.01Z"`. + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 4; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// The response message for [Conversations.ListMessages][google.cloud.dialogflow.v2beta1.Conversations.ListMessages]. +message ListMessagesResponse { + // Required. The list of messages. There will be a maximum number of items + // returned based on the page_size field in the request. + // `messages` is sorted by `create_time` in descending order. + repeated Message messages = 1; + + // Optional. Token to retrieve the next page of results, or empty if there are + // no more results in the list. + string next_page_token = 2; +} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_event.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_event.proto new file mode 100644 index 00000000..35c1de1e --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_event.proto @@ -0,0 +1,82 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/cloud/dialogflow/v2beta1/participant.proto"; +import "google/rpc/status.proto"; +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ConversationEventProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Represents a notification sent to Pub/Sub subscribers for conversation +// lifecycle events. +message ConversationEvent { + // Enumeration of the types of events available. + enum Type { + // Type not set. + TYPE_UNSPECIFIED = 0; + + // A new conversation has been opened. This is fired when a telephone call + // is answered, or a conversation is created via the API. + CONVERSATION_STARTED = 1; + + // An existing conversation has closed. This is fired when a telephone call + // is terminated, or a conversation is closed via the API. + CONVERSATION_FINISHED = 2; + + // An existing conversation has received a new message, either from API or + // telephony. It is configured in + // [ConversationProfile.new_message_event_notification_config][google.cloud.dialogflow.v2beta1.ConversationProfile.new_message_event_notification_config] + NEW_MESSAGE = 5; + + // Unrecoverable error during a telephone call. + // + // In general non-recoverable errors only occur if something was + // misconfigured in the ConversationProfile corresponding to the call. After + // a non-recoverable error, Dialogflow may stop responding. + // + // We don't fire this event: + // + // * in an API call because we can directly return the error, or, + // * when we can recover from an error. + UNRECOVERABLE_ERROR = 4; + } + + // Required. The unique identifier of the conversation this notification + // refers to. + // Format: `projects//conversations/`. + string conversation = 1; + + // Required. The type of the event that this notification refers to. + Type type = 2; + + // Optional. More detailed information about an error. Only set for type + // UNRECOVERABLE_ERROR_IN_PHONE_CALL. + google.rpc.Status error_status = 3; + + // Payload of conversation event. + oneof payload { + // Payload of NEW_MESSAGE event. + Message new_message_payload = 4; + } +} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto new file mode 100644 index 00000000..c08509e5 --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto @@ -0,0 +1,581 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2beta1/audio_config.proto"; +import "google/cloud/dialogflow/v2beta1/document.proto"; +import "google/cloud/dialogflow/v2beta1/participant.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ConversationProfileProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; +option (google.api.resource_definition) = { + type: "dialogflow.googleapis.com/CXSecuritySettings" + pattern: "projects/{project}/locations/{location}/securitySettings/{security_settings}" +}; +option (google.api.resource_definition) = { + type: "dialogflow.googleapis.com/ConversationModel" + pattern: "projects/{project}/locations/{location}/conversationModels/{conversation_model}" +}; + +// Service for managing [ConversationProfiles][google.cloud.dialogflow.v2beta1.ConversationProfile]. +service ConversationProfiles { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all conversation profiles in the specified project. + rpc ListConversationProfiles(ListConversationProfilesRequest) returns (ListConversationProfilesResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*}/conversationProfiles" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*}/conversationProfiles" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified conversation profile. + rpc GetConversationProfile(GetConversationProfileRequest) returns (ConversationProfile) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/conversationProfiles/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/conversationProfiles/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a conversation profile in the specified project. + // + // [ConversationProfile.CreateTime][] and [ConversationProfile.UpdateTime][] + // aren't populated in the response. You can retrieve them via + // [GetConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile] API. + rpc CreateConversationProfile(CreateConversationProfileRequest) returns (ConversationProfile) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*}/conversationProfiles" + body: "conversation_profile" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*}/conversationProfiles" + body: "conversation_profile" + } + }; + option (google.api.method_signature) = "parent,conversation_profile"; + } + + // Updates the specified conversation profile. + // + // [ConversationProfile.CreateTime][] and [ConversationProfile.UpdateTime][] + // aren't populated in the response. You can retrieve them via + // [GetConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile] API. + rpc UpdateConversationProfile(UpdateConversationProfileRequest) returns (ConversationProfile) { + option (google.api.http) = { + patch: "/v2beta1/{conversation_profile.name=projects/*/conversationProfiles/*}" + body: "conversation_profile" + additional_bindings { + patch: "/v2beta1/{conversation_profile.name=projects/*/locations/*/conversationProfiles/*}" + body: "conversation_profile" + } + }; + option (google.api.method_signature) = "conversation_profile,update_mask"; + } + + // Deletes the specified conversation profile. + rpc DeleteConversationProfile(DeleteConversationProfileRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta1/{name=projects/*/conversationProfiles/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/conversationProfiles/*}" + } + }; + option (google.api.method_signature) = "name"; + } +} + +// Defines the services to connect to incoming Dialogflow conversations. +message ConversationProfile { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/ConversationProfile" + pattern: "projects/{project}/conversationProfiles/{conversation_profile}" + pattern: "projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}" + }; + + // The unique identifier of this conversation profile. + // Format: `projects//locations//conversationProfiles/`. + string name = 1; + + // Required. Human readable name for this profile. Max length 1024 bytes. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Create time of the conversation profile. + google.protobuf.Timestamp create_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Update time of the conversation profile. + google.protobuf.Timestamp update_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Configuration for an automated agent to use with this profile. + AutomatedAgentConfig automated_agent_config = 3; + + // Configuration for agent assistance to use with this profile. + HumanAgentAssistantConfig human_agent_assistant_config = 4; + + // Configuration for connecting to a live agent. + // + // Currently, this feature is not general available, please contact Google + // to get access. + HumanAgentHandoffConfig human_agent_handoff_config = 5; + + // Configuration for publishing conversation lifecycle events. + NotificationConfig notification_config = 6; + + // Configuration for logging conversation lifecycle events. + LoggingConfig logging_config = 7; + + // Configuration for publishing new message events. Event will be sent in + // format of [ConversationEvent][google.cloud.dialogflow.v2beta1.ConversationEvent] + NotificationConfig new_message_event_notification_config = 8; + + // Settings for speech transcription. + SpeechToTextConfig stt_config = 9; + + // Language code for the conversation profile. If not specified, the language + // is en-US. Language at ConversationProfile should be set for all non en-us + // languages. + string language_code = 10; +} + +// Defines the Automated Agent to connect to a conversation. +message AutomatedAgentConfig { + // Required. ID of the Dialogflow agent environment to use. + // + // This project needs to either be the same project as the conversation or you + // need to grant `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow API + // Service Agent` role in this project. + // + // - For ES agents, use format: `projects//locations//agent/environments/`. If environment is not + // specified, the default `draft` environment is used. Refer to + // [DetectIntentRequest](/dialogflow/docs/reference/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.DetectIntentRequest) + // for more details. + // + // - For CX agents, use format `projects//locations//agents//environments/`. If environment is not specified, the default `draft` environment + // is used. + string agent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Agent" + } + ]; +} + +// Defines the Human Agent Assistant to connect to a conversation. +message HumanAgentAssistantConfig { + // Settings of suggestion trigger. + message SuggestionTriggerSettings { + // Do not trigger if last utterance is small talk. + bool no_small_talk = 1; + + // Only trigger suggestion if participant role of last utterance is + // END_USER. + bool only_end_user = 2; + } + + // Config for suggestion features. + message SuggestionFeatureConfig { + // The suggestion feature. + SuggestionFeature suggestion_feature = 5; + + // Automatically iterates all participants and tries to compile + // suggestions. + // + // Supported features: ARTICLE_SUGGESTION, FAQ, DIALOGFLOW_ASSIST. + bool enable_event_based_suggestion = 3; + + // Settings of suggestion trigger. + // + // Currently, only ARTICLE_SUGGESTION, FAQ, and DIALOGFLOW_ASSIST will use + // this field. + SuggestionTriggerSettings suggestion_trigger_settings = 10; + + // Configs of query. + SuggestionQueryConfig query_config = 6; + + // Configs of custom conversation model. + ConversationModelConfig conversation_model_config = 7; + } + + // Detail human agent assistant config. + message SuggestionConfig { + // Configuration of different suggestion features. One feature can have only + // one config. + repeated SuggestionFeatureConfig feature_configs = 2; + + // If `group_suggestion_responses` is false, and there are multiple + // `feature_configs` in `event based suggestion` or + // StreamingAnalyzeContent, we will try to deliver suggestions to customers + // as soon as we get new suggestion. Different type of suggestions based on + // the same context will be in separate Pub/Sub event or + // `StreamingAnalyzeContentResponse`. + // + // If `group_suggestion_responses` set to true. All the suggestions to the + // same participant based on the same context will be grouped into a single + // Pub/Sub event or StreamingAnalyzeContentResponse. + bool group_suggestion_responses = 3; + } + + // Config for suggestion query. + message SuggestionQueryConfig { + // Knowledge base source settings. + // + // Supported features: ARTICLE_SUGGESTION, FAQ. + message KnowledgeBaseQuerySource { + // Required. Knowledge bases to query. Format: + // `projects//locations//knowledgeBases/`. Currently, only one knowledge + // base is supported. + repeated string knowledge_bases = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/KnowledgeBase" + } + ]; + } + + // Document source settings. + // + // Supported features: SMART_REPLY, SMART_COMPOSE. + message DocumentQuerySource { + // Required. Knowledge documents to query from. Format: + // `projects//locations//knowledgeBases//documents/`. + // Currently, only one document is supported. + repeated string documents = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + } + ]; + } + + // Dialogflow source setting. + // + // Supported feature: DIALOGFLOW_ASSIST. + message DialogflowQuerySource { + // Required. The name of a dialogflow virtual agent used for end user side intent + // detection and suggestion. Format: `projects//locations//agent`. When multiple agents are allowed in + // the same Dialogflow project. + string agent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Agent" + } + ]; + } + + // Settings that determine how to filter recent conversation context when + // generating suggestions. + message ContextFilterSettings { + // If set to true, the last message from virtual agent (hand off message) + // and the message before it (trigger message of hand off) are dropped. + bool drop_handoff_messages = 1; + + // If set to true, all messages from virtual agent are dropped. + bool drop_virtual_agent_messages = 2; + + // If set to true, all messages from ivr stage are dropped. + bool drop_ivr_messages = 3; + } + + // Source of query. + oneof query_source { + // Query from knowledgebase. It is used by: + // ARTICLE_SUGGESTION, FAQ. + KnowledgeBaseQuerySource knowledge_base_query_source = 1; + + // Query from knowledge base document. It is used by: + // SMART_REPLY, SMART_COMPOSE. + DocumentQuerySource document_query_source = 2; + + // Query from Dialogflow agent. It is used by DIALOGFLOW_ASSIST. + DialogflowQuerySource dialogflow_query_source = 3; + } + + // Maximum number of results to return. Currently, if unset, defaults to 10. + // And the max number is 20. + int32 max_results = 4; + + // Confidence threshold of query result. + // + // Agent Assist gives each suggestion a score in the range [0.0, 1.0], based + // on the relevance between the suggestion and the current conversation + // context. A score of 0.0 has no relevance, while a score of 1.0 has high + // relevance. Only suggestions with a score greater than or equal to the + // value of this field are included in the results. + // + // For a baseline model (the default), the recommended value is in the range + // [0.05, 0.1]. + // + // For a custom model, there is no recommended value. Tune this value by + // starting from a very low value and slowly increasing until you have + // desired results. + // + // If this field is not set, it is default to 0.0, which means that all + // suggestions are returned. + // + // Supported features: ARTICLE_SUGGESTION, FAQ, SMART_REPLY, SMART_COMPOSE. + float confidence_threshold = 5; + + // Determines how recent conversation context is filtered when generating + // suggestions. If unspecified, no messages will be dropped. + ContextFilterSettings context_filter_settings = 7; + } + + // Custom conversation models used in agent assist feature. + // + // Supported feature: ARTICLE_SUGGESTION, SMART_COMPOSE, SMART_REPLY. + message ConversationModelConfig { + // Conversation model resource name. Format: `projects//conversationModels/`. + string model = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationModel" + }]; + } + + // Configuration for analyses to run on each conversation message. + message MessageAnalysisConfig { + // Enable entity extraction in conversation messages on [agent assist + // stage](https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages). + // If unspecified, defaults to false. + // + // Currently, this feature is not general available, please contact Google + // to get access. + bool enable_entity_extraction = 2; + + // Enable sentiment analysis in conversation messages on [agent assist + // stage](https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages). + // If unspecified, defaults to false. Sentiment analysis inspects user input + // and identifies the prevailing subjective opinion, especially to determine + // a user's attitude as positive, negative, or neutral: + // https://cloud.google.com/natural-language/docs/basics#sentiment_analysis + // For [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent] method, result will be in + // [StreamingAnalyzeContentResponse.message.SentimentAnalysisResult][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse.message]. + // For [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] method, result will be in + // [AnalyzeContentResponse.message.SentimentAnalysisResult][google.cloud.dialogflow.v2beta1.AnalyzeContentResponse.message] + // For [Conversations.ListMessages][google.cloud.dialogflow.v2beta1.Conversations.ListMessages] method, result will be in + // [ListMessagesResponse.messages.SentimentAnalysisResult][google.cloud.dialogflow.v2beta1.ListMessagesResponse.messages] + // If Pub/Sub notification is configured, result will be in + // [ConversationEvent.new_message_payload.SentimentAnalysisResult][google.cloud.dialogflow.v2beta1.ConversationEvent.new_message_payload]. + bool enable_sentiment_analysis = 3; + } + + // Pub/Sub topic on which to publish new agent assistant events. + NotificationConfig notification_config = 2; + + // Configuration for agent assistance of human agent participant. + SuggestionConfig human_agent_suggestion_config = 3; + + // Configuration for agent assistance of end user participant. + // + // Currently, this feature is not general available, please contact Google + // to get access. + SuggestionConfig end_user_suggestion_config = 4; + + // Configuration for message analysis. + MessageAnalysisConfig message_analysis_config = 5; +} + +// Defines the hand off to a live agent, typically on which external agent +// service provider to connect to a conversation. +// +// Currently, this feature is not general available, please contact Google +// to get access. +message HumanAgentHandoffConfig { + // Configuration specific to LivePerson (https://www.liveperson.com). + message LivePersonConfig { + // Required. Account number of the LivePerson account to connect. This is + // the account number you input at the login page. + string account_number = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // Configuration specific to Salesforce Live Agent. + message SalesforceLiveAgentConfig { + // Required. The organization ID of the Salesforce account. + string organization_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Live Agent deployment ID. + string deployment_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Live Agent chat button ID. + string button_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Domain of the Live Agent endpoint for this agent. You can find + // the endpoint URL in the `Live Agent settings` page. For example if URL + // has the form https://d.la4-c2-phx.salesforceliveagent.com/..., + // you should fill in d.la4-c2-phx.salesforceliveagent.com. + string endpoint_domain = 4 [(google.api.field_behavior) = REQUIRED]; + } + + // Required. Specifies which agent service to connect for human agent handoff. + oneof agent_service { + // Uses LivePerson (https://www.liveperson.com). + LivePersonConfig live_person_config = 1; + + // Uses Salesforce Live Agent. + SalesforceLiveAgentConfig salesforce_live_agent_config = 2; + } +} + +// Defines notification behavior. +message NotificationConfig { + // Format of cloud pub/sub message. + enum MessageFormat { + // If it is unspecified, PROTO will be used. + MESSAGE_FORMAT_UNSPECIFIED = 0; + + // Pubsub message will be serialized proto. + PROTO = 1; + + // Pubsub message will be json. + JSON = 2; + } + + // Name of the Pub/Sub topic to publish conversation + // events like + // [CONVERSATION_STARTED][google.cloud.dialogflow.v2beta1.ConversationEvent.Type.CONVERSATION_STARTED] as + // serialized [ConversationEvent][google.cloud.dialogflow.v2beta1.ConversationEvent] protos. + // + // Notification works for phone calls, if this topic either is in the same + // project as the conversation or you grant `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow Service + // Agent` role in the topic project. + // + // Format: `projects//locations//topics/`. + string topic = 1; + + // Format of message. + MessageFormat message_format = 2; +} + +// Defines logging behavior for conversation lifecycle events. +message LoggingConfig { + // Whether to log conversation events like + // [CONVERSATION_STARTED][google.cloud.dialogflow.v2beta1.ConversationEvent.Type.CONVERSATION_STARTED] to + // Stackdriver in the conversation project as JSON format + // [ConversationEvent][google.cloud.dialogflow.v2beta1.ConversationEvent] protos. + bool enable_stackdriver_logging = 3; +} + +// The request message for [ConversationProfiles.ListConversationProfiles][google.cloud.dialogflow.v2beta1.ConversationProfiles.ListConversationProfiles]. +message ListConversationProfilesRequest { + // Required. The project to list all conversation profiles from. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/ConversationProfile" + } + ]; + + // The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// The response message for [ConversationProfiles.ListConversationProfiles][google.cloud.dialogflow.v2beta1.ConversationProfiles.ListConversationProfiles]. +message ListConversationProfilesResponse { + // The list of project conversation profiles. There is a maximum number + // of items returned based on the page_size field in the request. + repeated ConversationProfile conversation_profiles = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [ConversationProfiles.GetConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile]. +message GetConversationProfileRequest { + // Required. The resource name of the conversation profile. + // Format: `projects//locations//conversationProfiles/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationProfile" + } + ]; +} + +// The request message for [ConversationProfiles.CreateConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfiles.CreateConversationProfile]. +message CreateConversationProfileRequest { + // Required. The project to create a conversation profile for. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/ConversationProfile" + } + ]; + + // Required. The conversation profile to create. + ConversationProfile conversation_profile = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [ConversationProfiles.UpdateConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfiles.UpdateConversationProfile]. +message UpdateConversationProfileRequest { + // Required. The conversation profile to update. + ConversationProfile conversation_profile = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields to update. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [ConversationProfiles.DeleteConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfiles.DeleteConversationProfile]. +// +// This operation fails if the conversation profile is still referenced from +// a phone number. +message DeleteConversationProfileRequest { + // Required. The name of the conversation profile to delete. + // Format: `projects//locations//conversationProfiles/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationProfile" + } + ]; +} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/document.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/document.proto new file mode 100644 index 00000000..25fdf0ce --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/document.proto @@ -0,0 +1,533 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2beta1/gcs.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "DocumentProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing knowledge [Documents][google.cloud.dialogflow.v2beta1.Document]. +service Documents { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all documents of the knowledge base. + // + // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + // only use `projects.knowledgeBases.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" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified document. + // + // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + // only use `projects.knowledgeBases.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/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new document. + // + // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + // only use `projects.knowledgeBases.documents`. + rpc CreateDocument(CreateDocumentRequest) returns (google.longrunning.Operation) { + 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" + } + }; + option (google.api.method_signature) = "parent,document"; + option (google.longrunning.operation_info) = { + response_type: "Document" + metadata_type: "KnowledgeOperationMetadata" + }; + } + + // Create documents by importing data from external sources. + // Dialogflow supports up to 350 documents in each request. If you try to + // import more, Dialogflow will return an error. + rpc ImportDocuments(ImportDocumentsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/knowledgeBases/*}/documents:import" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/knowledgeBases/*}/documents:import" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "ImportDocumentsResponse" + metadata_type: "KnowledgeOperationMetadata" + }; + } + + // Deletes the specified document. + // + // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + // only use `projects.knowledgeBases.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/*}" + } + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "KnowledgeOperationMetadata" + }; + } + + // Updates the specified document. + // + // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + // only use `projects.knowledgeBases.documents`. + rpc UpdateDocument(UpdateDocumentRequest) returns (google.longrunning.Operation) { + 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" + } + }; + option (google.api.method_signature) = "document,update_mask"; + option (google.api.method_signature) = "document"; + option (google.longrunning.operation_info) = { + response_type: "Document" + metadata_type: "KnowledgeOperationMetadata" + }; + } + + // Reloads the specified document from its specified source, content_uri or + // content. The previously loaded content of the document will be deleted. + // Note: Even when the content of the document has not changed, there still + // may be side effects because of internal implementation changes. + // Note: If the document source is Google Cloud Storage URI, its metadata will + // be replaced with the custom metadata from Google Cloud Storage if the + // `import_gcs_custom_metadata` field is set to true in the request. + // + // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + // only use `projects.knowledgeBases.documents`. + rpc ReloadDocument(ReloadDocumentRequest) returns (google.longrunning.Operation) { + 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: "*" + } + }; + option (google.api.method_signature) = "name,gcs_source"; + option (google.longrunning.operation_info) = { + response_type: "Document" + metadata_type: "KnowledgeOperationMetadata" + }; + } +} + +// A knowledge document to be used by a [KnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBase]. +// +// For more information, see the [knowledge base +// guide](https://cloud.google.com/dialogflow/docs/how/knowledge-bases). +// +// Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; +// only use `projects.knowledgeBases.documents`. +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. + message ReloadStatus { + // Output only. The time of a reload attempt. + // This reload may have been triggered automatically or manually and may + // not have succeeded. + google.protobuf.Timestamp time = 1; + + // Output only. The status of a reload attempt or the initial load. + google.rpc.Status status = 2; + } + + // The knowledge type of document content. + enum KnowledgeType { + // The type is unspecified or arbitrary. + KNOWLEDGE_TYPE_UNSPECIFIED = 0; + + // The document content contains question and answer pairs as either HTML or + // CSV. Typical FAQ HTML formats are parsed accurately, but unusual formats + // may fail to be parsed. + // + // CSV must have questions in the first column and answers in the second, + // with no header. Because of this explicit format, they are always parsed + // accurately. + FAQ = 1; + + // Documents for which unstructured text is extracted and used for + // question answering. + EXTRACTIVE_QA = 2; + + // The entire document content as a whole can be used for query results. + // Only for Contact Center Solutions on Dialogflow. + ARTICLE_SUGGESTION = 3; + + // The legacy enum for agent-facing smart reply feature. + SMART_REPLY = 4; + } + + // Optional. The document resource name. + // The name must be empty when creating a document. + // 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 + // less; otherwise, the creation request fails. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The MIME type of this document. + string mime_type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The knowledge type of document content. + repeated KnowledgeType knowledge_types = 4 [(google.api.field_behavior) = REQUIRED]; + + // The source of this document. + oneof source { + // The URI where the file content is located. + // + // For documents stored in Google Cloud Storage, these URIs must have + // the form `gs:///`. + // + // NOTE: External URLs must correspond to public webpages, i.e., they must + // be indexed by Google Search. In particular, URLs for showing documents in + // Google Cloud Storage (i.e. the URL in your browser) are not supported. + // Instead use the `gs://` format URI described above. + string content_uri = 5; + + // The raw content of the document. This field is only permitted for + // EXTRACTIVE_QA and FAQ knowledge types. + // Note: This field is in the process of being deprecated, please use + // raw_content instead. + string content = 6 [deprecated = true]; + + // The raw content of the document. This field is only permitted for + // EXTRACTIVE_QA and FAQ knowledge types. + bytes raw_content = 9; + } + + // Optional. If true, we try to automatically reload the document every day + // (at a time picked by the system). If false or unspecified, we don't try + // to automatically reload the document. + // + // Currently you can only enable automatic reload for documents sourced from + // a public url, see `source` field for the source types. + // + // Reload status can be tracked in `latest_reload_status`. If a reload + // fails, we will keep the document unchanged. + // + // If a reload fails with internal errors, the system will try to reload the + // document on the next day. + // If a reload fails with non-retriable errors (e.g. PERMISION_DENIED), the + // system will not try to reload the document anymore. You need to manually + // reload the document successfully by calling `ReloadDocument` and clear the + // errors. + bool enable_auto_reload = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The time and status of the latest reload. + // This reload may have been triggered automatically or manually + // and may not have succeeded. + ReloadStatus latest_reload_status = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Metadata for the document. The metadata supports arbitrary + // key-value pairs. Suggested use cases include storing a document's title, + // an external URL distinct from the document's content_uri, etc. + // The max size of a `key` or a `value` of the metadata is 1024 bytes. + map metadata = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [Documents.GetDocument][google.cloud.dialogflow.v2beta1.Documents.GetDocument]. +message GetDocumentRequest { + // Required. The name of the document to retrieve. + // Format `projects//locations//knowledgeBases//documents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + } + ]; +} + +// Request message for [Documents.ListDocuments][google.cloud.dialogflow.v2beta1.Documents.ListDocuments]. +message ListDocumentsRequest { + // Required. The knowledge base to list all documents for. + // Format: `projects//locations//knowledgeBases/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Document" + } + ]; + + // The maximum number of items to return in a single page. By + // default 10 and at most 100. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; + + // The filter expression used to filter documents returned by the list method. + // The expression has the following syntax: + // + // [AND ] ... + // + // The following fields and operators are supported: + // + // * knowledge_types with has(:) operator + // * display_name with has(:) operator + // * state with equals(=) operator + // + // Examples: + // + // * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + // * "display_name:customer" matches documents whose display name contains + // "customer". + // * "state=ACTIVE" matches documents with ACTIVE state. + // * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 4; +} + +// Response message for [Documents.ListDocuments][google.cloud.dialogflow.v2beta1.Documents.ListDocuments]. +message ListDocumentsResponse { + // The list of documents. + repeated Document documents = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// Request message for [Documents.CreateDocument][google.cloud.dialogflow.v2beta1.Documents.CreateDocument]. +message CreateDocumentRequest { + // Required. The knowledge base to create a document for. + // Format: `projects//locations//knowledgeBases/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Document" + } + ]; + + // 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.ImportDocuments][google.cloud.dialogflow.v2beta1.Documents.ImportDocuments]. +message ImportDocumentsRequest { + // Required. The knowledge base to import documents into. + // Format: `projects//locations//knowledgeBases/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Document" + } + ]; + + // Required. The source to use for importing documents. + // + // If the source captures multiple objects, then multiple documents will be + // created, one corresponding to each object, and all of these documents will + // be created using the same document template. + // + // Dialogflow supports up to 350 documents in each request. If you try to + // import more, Dialogflow will return an error. + oneof source { + // The Google Cloud Storage location for the documents. + // The path can include a wildcard. + // + // These URIs may have the forms + // `gs:///`. + // `gs:////*.`. + GcsSources gcs_source = 2; + } + + // Required. Document template used for importing all the documents. + ImportDocumentTemplate document_template = 3 [(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 = 4; +} + +// The template used for importing documents. +message ImportDocumentTemplate { + // Required. The MIME type of the document. + string mime_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The knowledge type of document content. + repeated Document.KnowledgeType knowledge_types = 2 [(google.api.field_behavior) = REQUIRED]; + + // Metadata for the document. The metadata supports arbitrary + // key-value pairs. Suggested use cases include storing a document's title, + // an external URL distinct from the document's content_uri, etc. + // The max size of a `key` or a `value` of the metadata is 1024 bytes. + map metadata = 3; +} + +// Response message for [Documents.ImportDocuments][google.cloud.dialogflow.v2beta1.Documents.ImportDocuments]. +message ImportDocumentsResponse { + // Includes details about skipped documents or any other warnings. + repeated google.rpc.Status warnings = 1; +} + +// Request message for [Documents.DeleteDocument][google.cloud.dialogflow.v2beta1.Documents.DeleteDocument]. +message DeleteDocumentRequest { + // Required. The name of the document to delete. + // Format: `projects//locations//knowledgeBases//documents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + } + ]; +} + +// Request message for [Documents.UpdateDocument][google.cloud.dialogflow.v2beta1.Documents.UpdateDocument]. +message UpdateDocumentRequest { + // Required. The document to update. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Not specified means `update all`. + // Currently, only `display_name` can be updated, an InvalidArgument will be + // returned for attempting to update other fields. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Metadata in google::longrunning::Operation for Knowledge operations. +message KnowledgeOperationMetadata { + // States of the operation. + enum State { + // State unspecified. + STATE_UNSPECIFIED = 0; + + // The operation has been created. + PENDING = 1; + + // The operation is currently running. + RUNNING = 2; + + // The operation is done, either cancelled or completed. + DONE = 3; + } + + // Required. Output only. The current state of this operation. + State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for [Documents.ReloadDocument][google.cloud.dialogflow.v2beta1.Documents.ReloadDocument]. +message ReloadDocumentRequest { + // Required. The name of the document to reload. + // Format: `projects//locations//knowledgeBases//documents/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + } + ]; + + // The source for document reloading. + // Optional. If provided, the service will load the contents from the source + // and update document in the knowledge base. + oneof source { + // The path for a Cloud Storage source file for reloading document content. + // 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/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/entity_type.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/entity_type.proto new file mode 100644 index 00000000..a1703f1b --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/entity_type.proto @@ -0,0 +1,571 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "EntityTypeProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [EntityTypes][google.cloud.dialogflow.v2beta1.EntityType]. +service EntityTypes { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all entity types in the specified agent. + rpc ListEntityTypes(ListEntityTypesRequest) returns (ListEntityTypesResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/agent}/entityTypes" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes" + } + }; + option (google.api.method_signature) = "parent"; + option (google.api.method_signature) = "parent,language_code"; + } + + // Retrieves the specified entity type. + rpc GetEntityType(GetEntityTypeRequest) returns (EntityType) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/agent/entityTypes/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/agent/entityTypes/*}" + } + }; + option (google.api.method_signature) = "name"; + option (google.api.method_signature) = "name,language_code"; + } + + // Creates an entity type in the specified agent. + rpc CreateEntityType(CreateEntityTypeRequest) returns (EntityType) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent}/entityTypes" + body: "entity_type" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes" + body: "entity_type" + } + }; + option (google.api.method_signature) = "parent,entity_type"; + option (google.api.method_signature) = "parent,entity_type,language_code"; + } + + // Updates the specified entity type. + rpc UpdateEntityType(UpdateEntityTypeRequest) returns (EntityType) { + option (google.api.http) = { + patch: "/v2beta1/{entity_type.name=projects/*/agent/entityTypes/*}" + body: "entity_type" + additional_bindings { + patch: "/v2beta1/{entity_type.name=projects/*/locations/*/agent/entityTypes/*}" + body: "entity_type" + } + }; + option (google.api.method_signature) = "entity_type"; + option (google.api.method_signature) = "entity_type,language_code"; + option (google.api.method_signature) = "entity_type,language_code,update_mask"; + } + + // Deletes the specified entity type. + rpc DeleteEntityType(DeleteEntityTypeRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta1/{name=projects/*/agent/entityTypes/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/agent/entityTypes/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Updates/Creates multiple entity types in the specified agent. + // Operation + rpc BatchUpdateEntityTypes(BatchUpdateEntityTypesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent}/entityTypes:batchUpdate" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes:batchUpdate" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse" + metadata_type: "google.protobuf.Struct" + }; + } + + // Deletes entity types in the specified agent. + // Operation + rpc BatchDeleteEntityTypes(BatchDeleteEntityTypesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent}/entityTypes:batchDelete" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes:batchDelete" + body: "*" + } + }; + option (google.api.method_signature) = "parent,entity_type_names"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Creates multiple new entities in the specified entity type. + // + // Operation + rpc BatchCreateEntities(BatchCreateEntitiesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchCreate" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchCreate" + body: "*" + } + }; + option (google.api.method_signature) = "parent,entities"; + option (google.api.method_signature) = "parent,entities,language_code"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Updates or creates multiple entities in the specified entity type. This + // method does not affect entities in the entity type that aren't explicitly + // specified in the request. + // + // Operation + rpc BatchUpdateEntities(BatchUpdateEntitiesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchUpdate" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchUpdate" + body: "*" + } + }; + option (google.api.method_signature) = "parent,entities"; + option (google.api.method_signature) = "parent,entities,language_code"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Deletes entities in the specified entity type. + // + // Operation + rpc BatchDeleteEntities(BatchDeleteEntitiesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchDelete" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchDelete" + body: "*" + } + }; + option (google.api.method_signature) = "parent,entity_values"; + option (google.api.method_signature) = "parent,entity_values,language_code"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } +} + +// Each intent parameter has a type, called the entity type, which dictates +// exactly how data from an end-user expression is extracted. +// +// Dialogflow provides predefined system entities that can match many common +// types of data. For example, there are system entities for matching dates, +// times, colors, email addresses, and so on. You can also create your own +// custom entities for matching custom data. For example, you could define a +// vegetable entity that can match the types of vegetables available for +// purchase with a grocery store agent. +// +// For more information, see the +// [Entity guide](https://cloud.google.com/dialogflow/docs/entities-overview). +message EntityType { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/EntityType" + pattern: "projects/{project}/agent/entityTypes/{entity_type}" + pattern: "projects/{project}/locations/{location}/agent/entityTypes/{entity_type}" + }; + + // An **entity entry** for an associated entity type. + message Entity { + // Required. The primary value associated with this entity entry. + // For example, if the entity type is *vegetable*, the value could be + // *scallions*. + // + // For `KIND_MAP` entity types: + // + // * A reference value to be used in place of synonyms. + // + // For `KIND_LIST` entity types: + // + // * A string that can contain references to other entity types (with or + // without aliases). + string value = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A collection of value synonyms. For example, if the entity type + // is *vegetable*, and `value` is *scallions*, a synonym could be *green + // onions*. + // + // For `KIND_LIST` entity types: + // + // * This collection must contain exactly one synonym equal to `value`. + repeated string synonyms = 2; + } + + // Represents kinds of entities. + enum Kind { + // Not specified. This value should be never used. + KIND_UNSPECIFIED = 0; + + // Map entity types allow mapping of a group of synonyms to a reference + // value. + KIND_MAP = 1; + + // List entity types contain a set of entries that do not map to reference + // values. However, list entity types can contain references to other entity + // types (with or without aliases). + KIND_LIST = 2; + + // Regexp entity types allow to specify regular expressions in entries + // values. + KIND_REGEXP = 3; + } + + // Represents different entity type expansion modes. Automated expansion + // allows an agent to recognize values that have not been explicitly listed in + // the entity (for example, new kinds of shopping list items). + enum AutoExpansionMode { + // Auto expansion disabled for the entity. + AUTO_EXPANSION_MODE_UNSPECIFIED = 0; + + // Allows an agent to recognize values that have not been explicitly + // listed in the entity. + AUTO_EXPANSION_MODE_DEFAULT = 1; + } + + // The unique identifier of the entity type. + // Required for [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType] and + // [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes] methods. + // Supported formats: + // - `projects//agent/entityTypes/` + // - `projects//locations//agent/entityTypes/` + string name = 1; + + // Required. The name of the entity type. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Indicates the kind of entity type. + Kind kind = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates whether the entity type can be automatically + // expanded. + AutoExpansionMode auto_expansion_mode = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of entity entries associated with the entity type. + repeated Entity entities = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Enables fuzzy entity extraction during classification. + bool enable_fuzzy_extraction = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes]. +message ListEntityTypesRequest { + // Required. The agent to list all entity types from. + // Supported formats: + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes]. +message ListEntityTypesResponse { + // The list of agent entity types. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated EntityType entity_types = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [EntityTypes.GetEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType]. +message GetEntityTypeRequest { + // Required. The name of the entity type. + // Supported formats: + // - `projects//agent/entityTypes/` + // - `projects//locations//agent/entityTypes/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.CreateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.CreateEntityType]. +message CreateEntityTypeRequest { + // Required. The agent to create a entity type for. + // Supported formats: + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The entity type to create. + EntityType entity_type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType]. +message UpdateEntityTypeRequest { + // Required. The entity type to update. + EntityType entity_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.DeleteEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.DeleteEntityType]. +message DeleteEntityTypeRequest { + // Required. The name of the entity type to delete. + // Supported formats: + // - `projects//agent/entityTypes/` + // - `projects//locations//agent/entityTypes/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; +} + +// The request message for [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes]. +message BatchUpdateEntityTypesRequest { + // Required. The name of the agent to update or create entity types in. + // Supported formats: + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // The source of the entity type batch. + // + // For each entity type in the batch: + // + // * If `name` is specified, we update an existing entity type. + // * If `name` is not specified, we create a new entity type. + oneof entity_type_batch { + // The URI to a Google Cloud Storage file containing entity types to update + // or create. The file format can either be a serialized proto (of + // EntityBatch type) or a JSON object. Note: The URI must start with + // "gs://". + string entity_type_batch_uri = 2; + + // The collection of entity types to update or create. + EntityTypeBatch entity_type_batch_inline = 3; + } + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes]. +message BatchUpdateEntityTypesResponse { + // The collection of updated or created entity types. + repeated EntityType entity_types = 1; +} + +// The request message for [EntityTypes.BatchDeleteEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntityTypes]. +message BatchDeleteEntityTypesRequest { + // Required. The name of the agent to delete all entities types for. + // Supported formats: + // - `projects//agent`, + // - `projects//locations//agent`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The names entity types to delete. All names must point to the + // same agent as `parent`. + repeated string entity_type_names = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntities]. +message BatchCreateEntitiesRequest { + // Required. The name of the entity type to create entities in. + // Supported formats: + // - `projects//agent/entityTypes/` + // - `projects//locations//agent/entityTypes/` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The entities to create. + repeated EntityType.Entity entities = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.BatchUpdateEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntities]. +message BatchUpdateEntitiesRequest { + // Required. The name of the entity type to update or create entities in. + // Supported formats: + // - `projects//agent/entityTypes/` + // - `projects//locations//agent/entityTypes/` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The entities to update or create. + repeated EntityType.Entity entities = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 4; +} + +// The request message for [EntityTypes.BatchDeleteEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntities]. +message BatchDeleteEntitiesRequest { + // Required. The name of the entity type to delete entries for. + // Supported formats: + // - `projects//agent/entityTypes/` + // - `projects//locations//agent/entityTypes/` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The reference `values` of the entities to delete. Note that + // these are not fully-qualified names, i.e. they don't start with + // `projects/`. + repeated string entity_values = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// This message is a wrapper around a collection of entity types. +message EntityTypeBatch { + // A collection of entity types. + repeated EntityType entity_types = 1; +} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/environment.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/environment.proto new file mode 100644 index 00000000..226c9a0d --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/environment.proto @@ -0,0 +1,367 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2beta1/audio_config.proto"; +import "google/cloud/dialogflow/v2beta1/fulfillment.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "EnvironmentProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Environments][google.cloud.dialogflow.v2beta1.Environment]. +service Environments { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all non-draft environments of the specified agent. + rpc ListEnvironments(ListEnvironmentsRequest) returns (ListEnvironmentsResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/agent}/environments" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/agent}/environments" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified agent environment. + rpc GetEnvironment(GetEnvironmentRequest) returns (Environment) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/agent/environments/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/agent/environments/*}" + } + }; + } + + // Creates an agent environment. + rpc CreateEnvironment(CreateEnvironmentRequest) returns (Environment) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent}/environments" + body: "environment" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent}/environments" + body: "environment" + } + }; + } + + // Updates the specified agent environment. + // + // This method allows you to deploy new agent versions into the environment. + // When an environment is pointed to a new agent version by setting + // `environment.agent_version`, the environment is temporarily set to the + // `LOADING` state. During that time, the environment keeps on serving the + // previous version of the agent. After the new agent version is done loading, + // the environment is set back to the `RUNNING` state. + // You can use "-" as Environment ID in environment name to update version + // in "draft" environment. WARNING: this will negate all recent changes to + // draft and can't be undone. You may want to save the draft to a version + // before calling this function. + rpc UpdateEnvironment(UpdateEnvironmentRequest) returns (Environment) { + option (google.api.http) = { + patch: "/v2beta1/{environment.name=projects/*/agent/environments/*}" + body: "environment" + additional_bindings { + patch: "/v2beta1/{environment.name=projects/*/locations/*/agent/environments/*}" + body: "environment" + } + }; + } + + // Deletes the specified agent environment. + rpc DeleteEnvironment(DeleteEnvironmentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta1/{name=projects/*/agent/environments/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/agent/environments/*}" + } + }; + } + + // Gets the history of the specified environment. + rpc GetEnvironmentHistory(GetEnvironmentHistoryRequest) returns (EnvironmentHistory) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/agent/environments/*}/history" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*}/history" + } + }; + } +} + +// You can create multiple versions of your agent and publish them to separate +// environments. +// +// When you edit an agent, you are editing the draft agent. At any point, you +// can save the draft agent as an agent version, which is an immutable snapshot +// of your agent. +// +// When you save the draft agent, it is published to the default environment. +// When you create agent versions, you can publish them to custom environments. +// You can create a variety of custom environments for: +// +// - testing +// - development +// - production +// - etc. +// +// For more information, see the [versions and environments +// guide](https://cloud.google.com/dialogflow/docs/agents-versions). +message Environment { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Environment" + pattern: "projects/{project}/agent/environments/{environment}" + pattern: "projects/{project}/locations/{location}/agent/environments/{environment}" + }; + + // Represents an environment state. When an environment is pointed to a new + // agent version, the environment is temporarily set to the `LOADING` state. + // During that time, the environment keeps on serving the previous version of + // the agent. After the new agent version is done loading, the environment is + // set back to the `RUNNING` state. + enum State { + // Not specified. This value is not used. + STATE_UNSPECIFIED = 0; + + // Stopped. + STOPPED = 1; + + // Loading. + LOADING = 2; + + // Running. + RUNNING = 3; + } + + // Output only. The unique identifier of this agent environment. + // Supported formats: + // - `projects//agent/environments/` + // - `projects//locations//agent/environments/` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The developer-provided description for this environment. + // The maximum length is 500 characters. If exceeded, the request is rejected. + string description = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The agent version loaded into this environment. + // Supported formats: + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` + string agent_version = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The state of this environment. This field is read-only, i.e., it cannot be + // set by create and update methods. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update time of this environment. This field is read-only, i.e., it + // cannot be set by create and update methods. + google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Text to speech settings for this environment. + TextToSpeechSettings text_to_speech_settings = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The fulfillment settings to use for this environment. + Fulfillment fulfillment = 8 [(google.api.field_behavior) = OPTIONAL]; +} + +// Instructs the speech synthesizer on how to generate the output audio content. +message TextToSpeechSettings { + // Optional. Indicates whether text to speech is enabled. Even when this field is false, + // other settings in this proto are still retained. + bool enable_text_to_speech = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Audio encoding of the synthesized audio content. + OutputAudioEncoding output_audio_encoding = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The synthesis sample rate (in hertz) for this audio. If not provided, then + // the synthesizer will use the default sample rate based on the audio + // encoding. If this is different from the voice's natural sample rate, then + // the synthesizer will honor this request by converting to the desired sample + // rate (which might result in worse audio quality). + int32 sample_rate_hertz = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Configuration of how speech should be synthesized, mapping from language + // (https://cloud.google.com/dialogflow/docs/reference/language) to + // SynthesizeSpeechConfig. + map synthesize_speech_configs = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Environments.ListEnvironments][google.cloud.dialogflow.v2beta1.Environments.ListEnvironments]. +message ListEnvironmentsRequest { + // Required. The agent to list all environments from. + // Format: + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Environment" + } + ]; + + // Optional. The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Environments.ListEnvironments][google.cloud.dialogflow.v2beta1.Environments.ListEnvironments]. +message ListEnvironmentsResponse { + // The list of agent environments. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Environment environments = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [Environments.GetEnvironment][google.cloud.dialogflow.v2beta1.Environments.GetEnvironment]. +message GetEnvironmentRequest { + // Required. The name of the environment. + // Supported formats: + // - `projects//agent/environments/` + // - `projects//locations//agent/environments/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Environment" + } + ]; +} + +// The request message for [Environments.CreateEnvironment][google.cloud.dialogflow.v2beta1.Environments.CreateEnvironment]. +message CreateEnvironmentRequest { + // Required. The agent to create an environment for. + // Supported formats: + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Environment" + } + ]; + + // Required. The environment to create. + Environment environment = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The unique id of the new environment. + string environment_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Environments.UpdateEnvironment][google.cloud.dialogflow.v2beta1.Environments.UpdateEnvironment]. +message UpdateEnvironmentRequest { + // Required. The environment to update. + Environment environment = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. This field is used to prevent accidental overwrite of the draft + // environment, which is an operation that cannot be undone. To confirm that + // the caller desires this overwrite, this field must be explicitly set to + // true when updating the draft environment (environment ID = `-`). + bool allow_load_to_draft_and_discard_changes = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Environments.DeleteEnvironment][google.cloud.dialogflow.v2beta1.Environments.DeleteEnvironment]. +message DeleteEnvironmentRequest { + // Required. The name of the environment to delete. + // / Format: + // - `projects//agent/environments/` + // - `projects//locations//agent/environments/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Environment" + } + ]; +} + +// The request message for [Environments.GetEnvironmentHistory][google.cloud.dialogflow.v2beta1.Environments.GetEnvironmentHistory]. +message GetEnvironmentHistoryRequest { + // Required. The name of the environment to retrieve history for. + // Supported formats: + // - `projects//agent/environments/` + // - `projects//locations//agent/environments/` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Environment" + } + ]; + + // Optional. The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Environments.GetEnvironmentHistory][google.cloud.dialogflow.v2beta1.Environments.GetEnvironmentHistory]. +message EnvironmentHistory { + // Represents an environment history entry. + message Entry { + // The agent version loaded into this environment history entry. + string agent_version = 1; + + // The developer-provided description for this environment history entry. + string description = 2; + + // The creation time of this environment history entry. + google.protobuf.Timestamp create_time = 3; + } + + // Output only. The name of the environment this history is for. + // Supported formats: + // - `projects//agent/environments/` + // - `projects//locations//agent/environments/` + string parent = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The list of agent environments. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Entry entries = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/fulfillment.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/fulfillment.proto new file mode 100644 index 00000000..d2466756 --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/fulfillment.proto @@ -0,0 +1,176 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "FulfillmentProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Fulfillments][google.cloud.dialogflow.v2beta1.Fulfillment]. +service Fulfillments { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Retrieves the fulfillment. + rpc GetFulfillment(GetFulfillmentRequest) returns (Fulfillment) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/agent/fulfillment}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/agent/fulfillment}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Updates the fulfillment. + rpc UpdateFulfillment(UpdateFulfillmentRequest) returns (Fulfillment) { + option (google.api.http) = { + patch: "/v2beta1/{fulfillment.name=projects/*/agent/fulfillment}" + body: "fulfillment" + additional_bindings { + patch: "/v2beta1/{fulfillment.name=projects/*/locations/*/agent/fulfillment}" + body: "fulfillment" + } + }; + option (google.api.method_signature) = "fulfillment,update_mask"; + } +} + +// By default, your agent responds to a matched intent with a static response. +// As an alternative, you can provide a more dynamic response by using +// fulfillment. When you enable fulfillment for an intent, Dialogflow responds +// to that intent by calling a service that you define. For example, if an +// end-user wants to schedule a haircut on Friday, your service can check your +// database and respond to the end-user with availability information for +// Friday. +// +// For more information, see the [fulfillment +// guide](https://cloud.google.com/dialogflow/docs/fulfillment-overview). +message Fulfillment { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Fulfillment" + pattern: "projects/{project}/agent/fulfillment" + pattern: "projects/{project}/locations/{location}/agent/fulfillment" + }; + + // Represents configuration for a generic web service. + // Dialogflow supports two mechanisms for authentications: + // - Basic authentication with username and password. + // - Authentication with additional authentication headers. + // More information could be found at: + // https://cloud.google.com/dialogflow/docs/fulfillment-configure. + message GenericWebService { + // Required. The fulfillment URI for receiving POST requests. + // It must use https protocol. + string uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // The user name for HTTP Basic authentication. + string username = 2; + + // The password for HTTP Basic authentication. + string password = 3; + + // The HTTP request headers to send together with fulfillment requests. + map request_headers = 4; + + // Optional. Indicates if generic web service is created through Cloud Functions + // integration. Defaults to false. + // + // is_cloud_function is deprecated. Cloud functions can be configured by + // its uri as a regular web service now. + bool is_cloud_function = 5 [ + deprecated = true, + (google.api.field_behavior) = OPTIONAL + ]; + } + + // Whether fulfillment is enabled for the specific feature. + message Feature { + // The type of the feature. + enum Type { + // Feature type not specified. + TYPE_UNSPECIFIED = 0; + + // Fulfillment is enabled for SmallTalk. + SMALLTALK = 1; + } + + // The type of the feature that enabled for fulfillment. + Type type = 1; + } + + // Required. The unique identifier of the fulfillment. + // Supported formats: + // - `projects//agent/fulfillment` + // - `projects//locations//agent/fulfillment` + // + // This field is not used for Fulfillment in an Environment. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // The human-readable name of the fulfillment, unique within the agent. + // + // This field is not used for Fulfillment in an Environment. + string display_name = 2; + + // Required. The fulfillment configuration. + oneof fulfillment { + // Configuration for a generic web service. + GenericWebService generic_web_service = 3; + } + + // Whether fulfillment is enabled. + bool enabled = 4; + + // The field defines whether the fulfillment is enabled for certain features. + repeated Feature features = 5; +} + +// The request message for [Fulfillments.GetFulfillment][google.cloud.dialogflow.v2beta1.Fulfillments.GetFulfillment]. +message GetFulfillmentRequest { + // Required. The name of the fulfillment. + // Supported formats: + // - `projects//agent/fulfillment` + // - `projects//locations//agent/fulfillment` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Fulfillment" + } + ]; +} + +// The request message for [Fulfillments.UpdateFulfillment][google.cloud.dialogflow.v2beta1.Fulfillments.UpdateFulfillment]. +message UpdateFulfillmentRequest { + // Required. The fulfillment to update. + Fulfillment fulfillment = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields get updated. If the mask is not + // present, all fields will be updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/gcs.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/gcs.proto new file mode 100644 index 00000000..f01ad76f --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/gcs.proto @@ -0,0 +1,46 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/field_behavior.proto"; +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "GcsProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Google Cloud Storage locations for the inputs. +message GcsSources { + // Required. Google Cloud Storage URIs for the inputs. A URI is of the + // form: + // gs://bucket/object-prefix-or-name + // Whether a prefix or name is used depends on the use case. + repeated string uris = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Google Cloud Storage location for single input. +message GcsSource { + // Required. The Google Cloud Storage URIs for the inputs. A URI is of the + // form: + // gs://bucket/object-prefix-or-name + // Whether a prefix or name is used depends on the use case. + string uri = 1; +} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto new file mode 100644 index 00000000..d49c83ac --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto @@ -0,0 +1,51 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/cloud/dialogflow/v2beta1/participant.proto"; +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "HumanAgentAssistantEventProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Output only. Represents a notification sent to Pub/Sub subscribers for +// agent assistant events in a specific conversation. +message HumanAgentAssistantEvent { + // The conversation this notification refers to. + // Format: `projects//conversations/`. + string conversation = 1; + + // The participant that the suggestion is compiled for. And This field is used + // to call [Participants.ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions] API. Format: + // `projects//conversations//participants/`. + // It will not be set in legacy workflow. + // [HumanAgentAssistantConfig.name][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.name] for more + // information. + string participant = 3; + + // The suggestion results payload that this notification refers to. It will + // only be set when + // [HumanAgentAssistantConfig.SuggestionConfig.group_suggestion_responses][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.group_suggestion_responses] + // sets to true. + repeated SuggestionResult suggestion_results = 5; +} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/intent.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/intent.proto new file mode 100644 index 00000000..ee31c026 --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/intent.proto @@ -0,0 +1,1422 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2beta1/audio_config.proto"; +import "google/cloud/dialogflow/v2beta1/context.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "IntentProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Intents][google.cloud.dialogflow.v2beta1.Intent]. +service Intents { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all intents in the specified agent. + rpc ListIntents(ListIntentsRequest) returns (ListIntentsResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/agent}/intents" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/agent}/intents" + } + additional_bindings { + get: "/v2beta1/{parent=projects/*/agent/environments/*}/intents" + } + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*}/intents" + } + }; + option (google.api.method_signature) = "parent"; + option (google.api.method_signature) = "parent,language_code"; + } + + // Retrieves the specified intent. + rpc GetIntent(GetIntentRequest) returns (Intent) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/agent/intents/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/agent/intents/*}" + } + }; + option (google.api.method_signature) = "name"; + option (google.api.method_signature) = "name,language_code"; + } + + // Creates an intent in the specified agent. + rpc CreateIntent(CreateIntentRequest) returns (Intent) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent}/intents" + body: "intent" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent}/intents" + body: "intent" + } + }; + option (google.api.method_signature) = "parent,intent"; + option (google.api.method_signature) = "parent,intent,language_code"; + } + + // Updates the specified intent. + rpc UpdateIntent(UpdateIntentRequest) returns (Intent) { + option (google.api.http) = { + patch: "/v2beta1/{intent.name=projects/*/agent/intents/*}" + body: "intent" + additional_bindings { + patch: "/v2beta1/{intent.name=projects/*/locations/*/agent/intents/*}" + body: "intent" + } + }; + option (google.api.method_signature) = "intent,update_mask"; + option (google.api.method_signature) = "intent"; + option (google.api.method_signature) = "intent,language_code"; + option (google.api.method_signature) = "intent,language_code,update_mask"; + } + + // Deletes the specified intent and its direct or indirect followup intents. + rpc DeleteIntent(DeleteIntentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta1/{name=projects/*/agent/intents/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/agent/intents/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Updates/Creates multiple intents in the specified agent. + // + // Operation + rpc BatchUpdateIntents(BatchUpdateIntentsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent}/intents:batchUpdate" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent}/intents:batchUpdate" + body: "*" + } + }; + option (google.api.method_signature) = "parent,intent_batch_uri"; + option (google.api.method_signature) = "parent,intent_batch_inline"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse" + metadata_type: "google.protobuf.Struct" + }; + } + + // Deletes intents in the specified agent. + // + // Operation + rpc BatchDeleteIntents(BatchDeleteIntentsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent}/intents:batchDelete" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent}/intents:batchDelete" + body: "*" + } + }; + option (google.api.method_signature) = "parent,intents"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } +} + +// An intent categorizes an end-user's intention for one conversation turn. For +// each agent, you define many intents, where your combined intents can handle a +// complete conversation. When an end-user writes or says something, referred to +// as an end-user expression or end-user input, Dialogflow matches the end-user +// input to the best intent in your agent. Matching an intent is also known as +// intent classification. +// +// For more information, see the [intent +// guide](https://cloud.google.com/dialogflow/docs/intents-overview). +message Intent { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Intent" + pattern: "projects/{project}/agent/intents/{intent}" + pattern: "projects/{project}/locations/{location}/agent/intents/{intent}" + }; + + // Represents an example that the agent is trained on. + message TrainingPhrase { + // Represents a part of a training phrase. + message Part { + // Required. The text for this part. + string text = 1; + + // Optional. The entity type name prefixed with `@`. + // This field is required for annotated parts of the training phrase. + string entity_type = 2; + + // Optional. The parameter name for the value extracted from the + // annotated part of the example. + // This field is required for annotated parts of the training phrase. + string alias = 3; + + // Optional. Indicates whether the text was manually annotated. + // This field is set to true when the Dialogflow Console is used to + // manually annotate the part. When creating an annotated part with the + // API, you must set this to true. + bool user_defined = 4; + } + + // Represents different types of training phrases. + enum Type { + // Not specified. This value should never be used. + TYPE_UNSPECIFIED = 0; + + // Examples do not contain @-prefixed entity type names, but example parts + // can be annotated with entity types. + EXAMPLE = 1; + + // Templates are not annotated with entity types, but they can contain + // @-prefixed entity type names as substrings. + // Template mode has been deprecated. Example mode is the only supported + // way to create new training phrases. If you have existing training + // phrases that you've created in template mode, those will continue to + // work. + TEMPLATE = 2 [deprecated = true]; + } + + // Output only. The unique identifier of this training phrase. + string name = 1; + + // Required. The type of the training phrase. + Type type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ordered list of training phrase parts. + // The parts are concatenated in order to form the training phrase. + // + // Note: The API does not automatically annotate training phrases like the + // Dialogflow Console does. + // + // Note: Do not forget to include whitespace at part boundaries, + // so the training phrase is well formatted when the parts are concatenated. + // + // If the training phrase does not need to be annotated with parameters, + // you just need a single part with only the [Part.text][google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part.text] field set. + // + // If you want to annotate the training phrase, you must create multiple + // parts, where the fields of each part are populated in one of two ways: + // + // - `Part.text` is set to a part of the phrase that has no parameters. + // - `Part.text` is set to a part of the phrase that you want to annotate, + // and the `entity_type`, `alias`, and `user_defined` fields are all + // set. + repeated Part parts = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates how many times this example was added to + // the intent. Each time a developer adds an existing sample by editing an + // intent or training, this counter is increased. + int32 times_added_count = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // Represents intent parameters. + message Parameter { + // The unique identifier of this parameter. + string name = 1; + + // Required. The name of the parameter. + string display_name = 2; + + // Optional. The definition of the parameter value. It can be: + // + // - a constant string, + // - a parameter value defined as `$parameter_name`, + // - an original parameter value defined as `$parameter_name.original`, + // - a parameter value from some context defined as + // `#context_name.parameter_name`. + string value = 3; + + // Optional. The default value to use when the `value` yields an empty + // result. + // Default values can be extracted from contexts by using the following + // syntax: `#context_name.parameter_name`. + string default_value = 4; + + // Optional. The name of the entity type, prefixed with `@`, that + // describes values of the parameter. If the parameter is + // required, this must be provided. + string entity_type_display_name = 5; + + // Optional. Indicates whether the parameter is required. That is, + // whether the intent cannot be completed without collecting the parameter + // value. + bool mandatory = 6; + + // Optional. The collection of prompts that the agent can present to the + // user in order to collect a value for the parameter. + repeated string prompts = 7; + + // Optional. Indicates whether the parameter represents a list of values. + bool is_list = 8; + } + + // Corresponds to the `Response` field in the Dialogflow console. + message Message { + // The text response message. + message Text { + // Optional. The collection of the agent's responses. + repeated string text = 1; + } + + // The image response message. + message Image { + // Optional. The public URI to an image file. + string image_uri = 1; + + // A text description of the image to be used for accessibility, + // e.g., screen readers. Required if image_uri is set for CarouselSelect. + string accessibility_text = 2; + } + + // The quick replies response message. + message QuickReplies { + // Optional. The title of the collection of quick replies. + string title = 1; + + // Optional. The collection of quick replies. + repeated string quick_replies = 2; + } + + // The card response message. + message Card { + // Optional. Contains information about a button. + message Button { + // Optional. The text to show on the button. + string text = 1; + + // Optional. The text to send back to the Dialogflow API or a URI to + // open. + string postback = 2; + } + + // Optional. The title of the card. + string title = 1; + + // Optional. The subtitle of the card. + string subtitle = 2; + + // Optional. The public URI to an image file for the card. + string image_uri = 3; + + // Optional. The collection of card buttons. + repeated Button buttons = 4; + } + + // The simple response message containing speech or text. + message SimpleResponse { + // One of text_to_speech or ssml must be provided. The plain text of the + // speech output. Mutually exclusive with ssml. + string text_to_speech = 1; + + // One of text_to_speech or ssml must be provided. Structured spoken + // response to the user in the SSML format. Mutually exclusive with + // text_to_speech. + string ssml = 2; + + // Optional. The text to display. + string display_text = 3; + } + + // The collection of simple response candidates. + // This message in `QueryResult.fulfillment_messages` and + // `WebhookResponse.fulfillment_messages` should contain only one + // `SimpleResponse`. + message SimpleResponses { + // Required. The list of simple responses. + repeated SimpleResponse simple_responses = 1; + } + + // The basic card message. Useful for displaying information. + message BasicCard { + // The button object that appears at the bottom of a card. + message Button { + // Opens the given URI. + message OpenUriAction { + // Required. The HTTP or HTTPS scheme URI. + string uri = 1; + } + + // Required. The title of the button. + string title = 1; + + // Required. Action to take when a user taps on the button. + OpenUriAction open_uri_action = 2; + } + + // Optional. The title of the card. + string title = 1; + + // Optional. The subtitle of the card. + string subtitle = 2; + + // Required, unless image is present. The body text of the card. + string formatted_text = 3; + + // Optional. The image for the card. + Image image = 4; + + // Optional. The collection of card buttons. + repeated Button buttons = 5; + } + + // The suggestion chip message that the user can tap to quickly post a reply + // to the conversation. + message Suggestion { + // Required. The text shown the in the suggestion chip. + string title = 1; + } + + // The collection of suggestions. + message Suggestions { + // Required. The list of suggested replies. + repeated Suggestion suggestions = 1; + } + + // The suggestion chip message that allows the user to jump out to the app + // or website associated with this agent. + message LinkOutSuggestion { + // Required. The name of the app or site this chip is linking to. + string destination_name = 1; + + // Required. The URI of the app or site to open when the user taps the + // suggestion chip. + string uri = 2; + } + + // The card for presenting a list of options to select from. + message ListSelect { + // An item in the list. + message Item { + // Required. Additional information about this option. + SelectItemInfo info = 1; + + // Required. The title of the list item. + string title = 2; + + // Optional. The main text describing the item. + string description = 3; + + // Optional. The image to display. + Image image = 4; + } + + // Optional. The overall title of the list. + string title = 1; + + // Required. List items. + repeated Item items = 2; + + // Optional. Subtitle of the list. + string subtitle = 3 [(google.api.field_behavior) = OPTIONAL]; + } + + // The card for presenting a carousel of options to select from. + message CarouselSelect { + // An item in the carousel. + message Item { + // Required. Additional info about the option item. + SelectItemInfo info = 1; + + // Required. Title of the carousel item. + string title = 2; + + // Optional. The body text of the card. + string description = 3; + + // Optional. The image to display. + Image image = 4; + } + + // Required. Carousel items. + repeated Item items = 1; + } + + // Additional info about the select item for when it is triggered in a + // dialog. + message SelectItemInfo { + // Required. A unique key that will be sent back to the agent if this + // response is given. + string key = 1; + + // Optional. A list of synonyms that can also be used to trigger this + // item in dialog. + repeated string synonyms = 2; + } + + // Plays audio from a file in Telephony Gateway. + message TelephonyPlayAudio { + // Required. URI to a Google Cloud Storage object containing the audio to + // play, e.g., "gs://bucket/object". The object must contain a single + // channel (mono) of linear PCM audio (2 bytes / sample) at 8kHz. + // + // This object must be readable by the `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` service account + // where is the number of the Telephony Gateway project + // (usually the same as the Dialogflow agent project). If the Google Cloud + // Storage bucket is in the Telephony Gateway project, this permission is + // added by default when enabling the Dialogflow V2 API. + // + // For audio from other sources, consider using the + // `TelephonySynthesizeSpeech` message with SSML. + string audio_uri = 1; + } + + // Synthesizes speech and plays back the synthesized audio to the caller in + // Telephony Gateway. + // + // Telephony Gateway takes the synthesizer settings from + // `DetectIntentResponse.output_audio_config` which can either be set + // at request-level or can come from the agent-level synthesizer config. + message TelephonySynthesizeSpeech { + // Required. The source to be synthesized. + oneof source { + // The raw text to be synthesized. + string text = 1; + + // The SSML to be synthesized. For more information, see + // [SSML](https://developers.google.com/actions/reference/ssml). + string ssml = 2; + } + } + + // Transfers the call in Telephony Gateway. + message TelephonyTransferCall { + // Required. The phone number to transfer the call to + // in [E.164 format](https://en.wikipedia.org/wiki/E.164). + // + // We currently only allow transferring to US numbers (+1xxxyyyzzzz). + string phone_number = 1; + } + + // Rich Business Messaging (RBM) text response with suggestions. + message RbmText { + // Required. Text sent and displayed to the user. + string text = 1; + + // Optional. One or more suggestions to show to the user. + repeated RbmSuggestion rbm_suggestion = 2; + } + + // Carousel Rich Business Messaging (RBM) rich card. + // + // Rich cards allow you to respond to users with more vivid content, e.g. + // with media and suggestions. + // + // If you want to show a single card with more control over the layout, + // please use [RbmStandaloneCard][google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard] instead. + message RbmCarouselCard { + // The width of the cards in the carousel. + enum CardWidth { + // Not specified. + CARD_WIDTH_UNSPECIFIED = 0; + + // 120 DP. Note that tall media cannot be used. + SMALL = 1; + + // 232 DP. + MEDIUM = 2; + } + + // Required. The width of the cards in the carousel. + CardWidth card_width = 1; + + // Required. The cards in the carousel. A carousel must have at least + // 2 cards and at most 10. + repeated RbmCardContent card_contents = 2; + } + + // Standalone Rich Business Messaging (RBM) rich card. + // + // Rich cards allow you to respond to users with more vivid content, e.g. + // with media and suggestions. + // + // You can group multiple rich cards into one using [RbmCarouselCard][google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard] but + // carousel cards will give you less control over the card layout. + message RbmStandaloneCard { + // Orientation of the card. + enum CardOrientation { + // Not specified. + CARD_ORIENTATION_UNSPECIFIED = 0; + + // Horizontal layout. + HORIZONTAL = 1; + + // Vertical layout. + VERTICAL = 2; + } + + // Thumbnail preview alignment for standalone cards with horizontal + // layout. + enum ThumbnailImageAlignment { + // Not specified. + THUMBNAIL_IMAGE_ALIGNMENT_UNSPECIFIED = 0; + + // Thumbnail preview is left-aligned. + LEFT = 1; + + // Thumbnail preview is right-aligned. + RIGHT = 2; + } + + // Required. Orientation of the card. + CardOrientation card_orientation = 1; + + // Required if orientation is horizontal. + // Image preview alignment for standalone cards with horizontal layout. + ThumbnailImageAlignment thumbnail_image_alignment = 2; + + // Required. Card content. + RbmCardContent card_content = 3; + } + + // Rich Business Messaging (RBM) Card content + message RbmCardContent { + // Rich Business Messaging (RBM) Media displayed in Cards + // The following media-types are currently supported: + // + // Image Types + // + // * image/jpeg + // * image/jpg' + // * image/gif + // * image/png + // + // Video Types + // + // * video/h263 + // * video/m4v + // * video/mp4 + // * video/mpeg + // * video/mpeg4 + // * video/webm + message RbmMedia { + // Media height + enum Height { + // Not specified. + HEIGHT_UNSPECIFIED = 0; + + // 112 DP. + SHORT = 1; + + // 168 DP. + MEDIUM = 2; + + // 264 DP. Not available for rich card carousels when the card width + // is set to small. + TALL = 3; + } + + // Required. Publicly reachable URI of the file. The RBM platform + // determines the MIME type of the file from the content-type field in + // the HTTP headers when the platform fetches the file. The content-type + // field must be present and accurate in the HTTP response from the URL. + string file_uri = 1; + + // Optional. Publicly reachable URI of the thumbnail.If you don't + // provide a thumbnail URI, the RBM platform displays a blank + // placeholder thumbnail until the user's device downloads the file. + // Depending on the user's setting, the file may not download + // automatically and may require the user to tap a download button. + string thumbnail_uri = 2; + + // Required for cards with vertical orientation. The height of the media + // within a rich card with a vertical layout. + // For a standalone card with horizontal layout, height is not + // customizable, and this field is ignored. + Height height = 3; + } + + // Optional. Title of the card (at most 200 bytes). + // + // At least one of the title, description or media must be set. + string title = 1; + + // Optional. Description of the card (at most 2000 bytes). + // + // At least one of the title, description or media must be set. + string description = 2; + + // Optional. However at least one of the title, description or media must + // be set. Media (image, GIF or a video) to include in the card. + RbmMedia media = 3; + + // Optional. List of suggestions to include in the card. + repeated RbmSuggestion suggestions = 4; + } + + // Rich Business Messaging (RBM) suggestion. Suggestions allow user to + // easily select/click a predefined response or perform an action (like + // opening a web uri). + message RbmSuggestion { + // Predefined suggested response or action for user to choose + oneof suggestion { + // Predefined replies for user to select instead of typing + RbmSuggestedReply reply = 1; + + // Predefined client side actions that user can choose + RbmSuggestedAction action = 2; + } + } + + // Rich Business Messaging (RBM) suggested reply that the user can click + // instead of typing in their own response. + message RbmSuggestedReply { + // Suggested reply text. + string text = 1; + + // Opaque payload that the Dialogflow receives in a user event + // when the user taps the suggested reply. This data will be also + // forwarded to webhook to allow performing custom business logic. + string postback_data = 2; + } + + // Rich Business Messaging (RBM) suggested client-side action that the user + // can choose from the card. + message RbmSuggestedAction { + // Opens the user's default dialer app with the specified phone number + // but does not dial automatically. + message RbmSuggestedActionDial { + // Required. The phone number to fill in the default dialer app. + // This field should be in [E.164](https://en.wikipedia.org/wiki/E.164) + // format. An example of a correctly formatted phone number: + // +15556767888. + string phone_number = 1; + } + + // Opens the user's default web browser app to the specified uri + // If the user has an app installed that is + // registered as the default handler for the URL, then this app will be + // opened instead, and its icon will be used in the suggested action UI. + message RbmSuggestedActionOpenUri { + // Required. The uri to open on the user device + string uri = 1; + } + + // Opens the device's location chooser so the user can pick a location + // to send back to the agent. + message RbmSuggestedActionShareLocation { + + } + + // Text to display alongside the action. + string text = 1; + + // Opaque payload that the Dialogflow receives in a user event + // when the user taps the suggested action. This data will be also + // forwarded to webhook to allow performing custom business logic. + string postback_data = 2; + + // Action that needs to be triggered. + oneof action { + // Suggested client side action: Dial a phone number + RbmSuggestedActionDial dial = 3; + + // Suggested client side action: Open a URI on device + RbmSuggestedActionOpenUri open_url = 4; + + // Suggested client side action: Share user location + RbmSuggestedActionShareLocation share_location = 5; + } + } + + // The media content card for Actions on Google. + message MediaContent { + // Response media object for media content card. + message ResponseMediaObject { + // Required. Name of media card. + string name = 1; + + // Optional. Description of media card. + string description = 2; + + // Image to show with the media card. + oneof image { + // Optional. Image to display above media content. + Image large_image = 3; + + // Optional. Icon to display above media content. + Image icon = 4; + } + + // Required. Url where the media is stored. + string content_url = 5; + } + + // Format of response media type. + enum ResponseMediaType { + // Unspecified. + RESPONSE_MEDIA_TYPE_UNSPECIFIED = 0; + + // Response media type is audio. + AUDIO = 1; + } + + // Optional. What type of media is the content (ie "audio"). + ResponseMediaType media_type = 1; + + // Required. List of media objects. + repeated ResponseMediaObject media_objects = 2; + } + + // Browse Carousel Card for Actions on Google. + // https://developers.google.com/actions/assistant/responses#browsing_carousel + message BrowseCarouselCard { + // Browsing carousel tile + message BrowseCarouselCardItem { + // Actions on Google action to open a given url. + message OpenUrlAction { + // Type of the URI. + enum UrlTypeHint { + // Unspecified + URL_TYPE_HINT_UNSPECIFIED = 0; + + // Url would be an amp action + AMP_ACTION = 1; + + // URL that points directly to AMP content, or to a canonical URL + // which refers to AMP content via . + AMP_CONTENT = 2; + } + + // Required. URL + string url = 1; + + // Optional. Specifies the type of viewer that is used when opening + // the URL. Defaults to opening via web browser. + UrlTypeHint url_type_hint = 3; + } + + // Required. Action to present to the user. + OpenUrlAction open_uri_action = 1; + + // Required. Title of the carousel item. Maximum of two lines of text. + string title = 2; + + // Optional. Description of the carousel item. Maximum of four lines of + // text. + string description = 3; + + // Optional. Hero image for the carousel item. + Image image = 4; + + // Optional. Text that appears at the bottom of the Browse Carousel + // Card. Maximum of one line of text. + string footer = 5; + } + + // Image display options for Actions on Google. This should be used for + // when the image's aspect ratio does not match the image container's + // aspect ratio. + enum ImageDisplayOptions { + // Fill the gaps between the image and the image container with gray + // bars. + IMAGE_DISPLAY_OPTIONS_UNSPECIFIED = 0; + + // Fill the gaps between the image and the image container with gray + // bars. + GRAY = 1; + + // Fill the gaps between the image and the image container with white + // bars. + WHITE = 2; + + // Image is scaled such that the image width and height match or exceed + // the container dimensions. This may crop the top and bottom of the + // image if the scaled image height is greater than the container + // height, or crop the left and right of the image if the scaled image + // width is greater than the container width. This is similar to "Zoom + // Mode" on a widescreen TV when playing a 4:3 video. + CROPPED = 3; + + // Pad the gaps between image and image frame with a blurred copy of the + // same image. + BLURRED_BACKGROUND = 4; + } + + // Required. List of items in the Browse Carousel Card. Minimum of two + // items, maximum of ten. + repeated BrowseCarouselCardItem items = 1; + + // Optional. Settings for displaying the image. Applies to every image in + // [items][google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.items]. + ImageDisplayOptions image_display_options = 2; + } + + // Table card for Actions on Google. + message TableCard { + // Required. Title of the card. + string title = 1; + + // Optional. Subtitle to the title. + string subtitle = 2; + + // Optional. Image which should be displayed on the card. + Image image = 3; + + // Optional. Display properties for the columns in this table. + repeated ColumnProperties column_properties = 4; + + // Optional. Rows in this table of data. + repeated TableCardRow rows = 5; + + // Optional. List of buttons for the card. + repeated BasicCard.Button buttons = 6; + } + + // Column properties for [TableCard][google.cloud.dialogflow.v2beta1.Intent.Message.TableCard]. + message ColumnProperties { + // Text alignments within a cell. + enum HorizontalAlignment { + // Text is aligned to the leading edge of the column. + HORIZONTAL_ALIGNMENT_UNSPECIFIED = 0; + + // Text is aligned to the leading edge of the column. + LEADING = 1; + + // Text is centered in the column. + CENTER = 2; + + // Text is aligned to the trailing edge of the column. + TRAILING = 3; + } + + // Required. Column heading. + string header = 1; + + // Optional. Defines text alignment for all cells in this column. + HorizontalAlignment horizontal_alignment = 2; + } + + // Row of [TableCard][google.cloud.dialogflow.v2beta1.Intent.Message.TableCard]. + message TableCardRow { + // Optional. List of cells that make up this row. + repeated TableCardCell cells = 1; + + // Optional. Whether to add a visual divider after this row. + bool divider_after = 2; + } + + // Cell of [TableCardRow][google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow]. + message TableCardCell { + // Required. Text in this cell. + string text = 1; + } + + // Represents different platforms that a rich message can be intended for. + enum Platform { + // Not specified. + PLATFORM_UNSPECIFIED = 0; + + // Facebook. + FACEBOOK = 1; + + // Slack. + SLACK = 2; + + // Telegram. + TELEGRAM = 3; + + // Kik. + KIK = 4; + + // Skype. + SKYPE = 5; + + // Line. + LINE = 6; + + // Viber. + VIBER = 7; + + // Google Assistant + // See [Dialogflow webhook + // format](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json) + ACTIONS_ON_GOOGLE = 8; + + // Telephony Gateway. + TELEPHONY = 10; + + // Google Hangouts. + GOOGLE_HANGOUTS = 11; + } + + // Required. The rich response message. + oneof message { + // Returns a text response. + Text text = 1; + + // Displays an image. + Image image = 2; + + // Displays quick replies. + QuickReplies quick_replies = 3; + + // Displays a card. + Card card = 4; + + // A custom platform-specific response. + google.protobuf.Struct payload = 5; + + // Returns a voice or text-only response for Actions on Google. + SimpleResponses simple_responses = 7; + + // Displays a basic card for Actions on Google. + BasicCard basic_card = 8; + + // Displays suggestion chips for Actions on Google. + Suggestions suggestions = 9; + + // Displays a link out suggestion chip for Actions on Google. + LinkOutSuggestion link_out_suggestion = 10; + + // Displays a list card for Actions on Google. + ListSelect list_select = 11; + + // Displays a carousel card for Actions on Google. + CarouselSelect carousel_select = 12; + + // Plays audio from a file in Telephony Gateway. + TelephonyPlayAudio telephony_play_audio = 13; + + // Synthesizes speech in Telephony Gateway. + TelephonySynthesizeSpeech telephony_synthesize_speech = 14; + + // Transfers the call in Telephony Gateway. + TelephonyTransferCall telephony_transfer_call = 15; + + // Rich Business Messaging (RBM) text response. + // + // RBM allows businesses to send enriched and branded versions of SMS. See + // https://jibe.google.com/business-messaging. + RbmText rbm_text = 18; + + // Standalone Rich Business Messaging (RBM) rich card response. + RbmStandaloneCard rbm_standalone_rich_card = 19; + + // Rich Business Messaging (RBM) carousel rich card response. + RbmCarouselCard rbm_carousel_rich_card = 20; + + // Browse carousel card for Actions on Google. + BrowseCarouselCard browse_carousel_card = 22; + + // Table card for Actions on Google. + TableCard table_card = 23; + + // The media content card for Actions on Google. + MediaContent media_content = 24; + } + + // Optional. The platform that this message is intended for. + Platform platform = 6 [(google.api.field_behavior) = OPTIONAL]; + } + + // Represents a single followup intent in the chain. + message FollowupIntentInfo { + // The unique identifier of the followup intent. + // Format: `projects//agent/intents/`. + string followup_intent_name = 1; + + // The unique identifier of the followup intent's parent. + // Format: `projects//agent/intents/`. + string parent_followup_intent_name = 2; + } + + // Represents the different states that webhooks can be in. + enum WebhookState { + // Webhook is disabled in the agent and in the intent. + WEBHOOK_STATE_UNSPECIFIED = 0; + + // Webhook is enabled in the agent and in the intent. + WEBHOOK_STATE_ENABLED = 1; + + // Webhook is enabled in the agent and in the intent. Also, each slot + // filling prompt is forwarded to the webhook. + WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING = 2; + } + + // Optional. The unique identifier of this intent. + // Required for [Intents.UpdateIntent][google.cloud.dialogflow.v2beta1.Intents.UpdateIntent] and [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents] + // methods. + // Supported formats: + // + // - `projects//agent/intents/` + // - `projects//locations//agent/intents/` + string name = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The name of this intent. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates whether webhooks are enabled for the intent. + WebhookState webhook_state = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The priority of this intent. Higher numbers represent higher + // priorities. + // + // - If the supplied value is unspecified or 0, the service + // translates the value to 500,000, which corresponds to the + // `Normal` priority in the console. + // - If the supplied value is negative, the intent is ignored + // in runtime detect intent requests. + int32 priority = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether this is a fallback intent. + bool is_fallback = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether Machine Learning is enabled for the intent. + // Note: If `ml_enabled` setting is set to false, then this intent is not + // taken into account during inference in `ML ONLY` match mode. Also, + // auto-markup in the UI is turned off. + // DEPRECATED! Please use `ml_disabled` field instead. + // NOTE: If both `ml_enabled` and `ml_disabled` are either not set or false, + // then the default value is determined as follows: + // + // - Before April 15th, 2018 the default is: + // ml_enabled = false / ml_disabled = true. + // - After April 15th, 2018 the default is: + // ml_enabled = true / ml_disabled = false. + bool ml_enabled = 5 [ + deprecated = true, + (google.api.field_behavior) = OPTIONAL + ]; + + // Optional. Indicates whether Machine Learning is disabled for the intent. + // Note: If `ml_disabled` setting is set to true, then this intent is not + // taken into account during inference in `ML ONLY` match mode. Also, + // auto-markup in the UI is turned off. + bool ml_disabled = 19 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates that a live agent should be brought in to handle the + // interaction with the user. In most cases, when you set this flag to true, + // you would also want to set end_interaction to true as well. Default is + // false. + bool live_agent_handoff = 20 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates that this intent ends an interaction. Some integrations + // (e.g., Actions on Google or Dialogflow phone gateway) use this information + // to close interaction with an end user. Default is false. + bool end_interaction = 21 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The list of context names required for this intent to be + // triggered. + // Formats: + // + // - `projects//agent/sessions/-/contexts/` + // - `projects//locations//agent/sessions/-/contexts/` + repeated string input_context_names = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of event names that trigger the intent. + // If the collection of input contexts is not empty, all of the contexts must + // be present in the active user session for an event to trigger this intent. + // Event names are limited to 150 characters. + repeated string events = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of examples that the agent is + // trained on. + repeated TrainingPhrase training_phrases = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the action associated with the intent. + // Note: The action name must not contain whitespaces. + string action = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of contexts that are activated when the intent + // is matched. Context messages in this collection should not set the + // parameters field. Setting the `lifespan_count` to 0 will reset the context + // when the intent is matched. + // Format: `projects//agent/sessions/-/contexts/`. + repeated Context output_contexts = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether to delete all contexts in the current + // session when this intent is matched. + bool reset_contexts = 12 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of parameters associated with the intent. + repeated Parameter parameters = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of rich messages corresponding to the + // `Response` field in the Dialogflow console. + repeated Message messages = 14; + + // Optional. The list of platforms for which the first responses will be + // copied from the messages in PLATFORM_UNSPECIFIED (i.e. default platform). + repeated Message.Platform default_response_platforms = 15 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The unique identifier of the root intent in the chain of + // followup intents. It identifies the correct followup intents chain for + // this intent. + // + // Format: `projects//agent/intents/`. + string root_followup_intent_name = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The unique identifier of the parent intent in the + // chain of followup intents. You can set this field when creating an intent, + // for example with [CreateIntent][google.cloud.dialogflow.v2beta1.Intents.CreateIntent] or + // [BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents], in order to make this + // intent a followup intent. + // + // It identifies the parent followup intent. + // Format: `projects//agent/intents/`. + string parent_followup_intent_name = 17 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Information about all followup intents that have this intent as + // a direct or indirect parent. We populate this field only in the output. + repeated FollowupIntentInfo followup_intent_info = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request message for [Intents.ListIntents][google.cloud.dialogflow.v2beta1.Intents.ListIntents]. +message ListIntentsRequest { + // Required. The agent to list all intents from. + // Format: `projects//agent` or `projects//locations//agent`. + // + // Alternatively, you can specify the environment to list intents for. + // Format: `projects//agent/environments/` + // or `projects//locations//agent/environments/`. + // Note: training phrases of the intents will not be returned for non-draft + // environment. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Intent" + } + ]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The resource view to apply to the returned intent. + IntentView intent_view = 3; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 4; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 5; +} + +// The response message for [Intents.ListIntents][google.cloud.dialogflow.v2beta1.Intents.ListIntents]. +message ListIntentsResponse { + // The list of agent intents. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Intent intents = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [Intents.GetIntent][google.cloud.dialogflow.v2beta1.Intents.GetIntent]. +message GetIntentRequest { + // Required. The name of the intent. + // Supported formats: + // + // - `projects//agent/intents/` + // - `projects//locations//agent/intents/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Intent" + } + ]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The resource view to apply to the returned intent. + IntentView intent_view = 3; +} + +// The request message for [Intents.CreateIntent][google.cloud.dialogflow.v2beta1.Intents.CreateIntent]. +message CreateIntentRequest { + // Required. The agent to create a intent for. + // Supported formats: + // + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Intent" + } + ]; + + // Required. The intent to create. + Intent intent = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The resource view to apply to the returned intent. + IntentView intent_view = 4; +} + +// The request message for [Intents.UpdateIntent][google.cloud.dialogflow.v2beta1.Intents.UpdateIntent]. +message UpdateIntentRequest { + // Required. The intent to update. + Intent intent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 3; + + // Optional. The resource view to apply to the returned intent. + IntentView intent_view = 4; +} + +// The request message for [Intents.DeleteIntent][google.cloud.dialogflow.v2beta1.Intents.DeleteIntent]. +message DeleteIntentRequest { + // Required. The name of the intent to delete. If this intent has direct or + // indirect followup intents, we also delete them. + // + // Supported formats: + // + // - `projects//agent/intents/` + // - `projects//locations//agent/intents/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Intent" + } + ]; +} + +// The request message for [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents]. +message BatchUpdateIntentsRequest { + // Required. The name of the agent to update or create intents in. + // Supported formats: + // + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Intent" + } + ]; + + // Required. The source of the intent batch. + // + // For each intent in the batch: + // + // * If `name` is specified, we update an existing intent. + // * If `name` is not specified, we create a new intent. + oneof intent_batch { + // The URI to a Google Cloud Storage file containing intents to update or + // create. The file format can either be a serialized proto (of IntentBatch + // type) or JSON object. Note: The URI must start with "gs://". + string intent_batch_uri = 2; + + // The collection of intents to update or create. + IntentBatch intent_batch_inline = 3; + } + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 5; + + // Optional. The resource view to apply to the returned intent. + IntentView intent_view = 6; +} + +// The response message for [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents]. +message BatchUpdateIntentsResponse { + // The collection of updated or created intents. + repeated Intent intents = 1; +} + +// The request message for [Intents.BatchDeleteIntents][google.cloud.dialogflow.v2beta1.Intents.BatchDeleteIntents]. +message BatchDeleteIntentsRequest { + // Required. The name of the agent to delete all entities types for. + // Supported formats: + // + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Intent" + } + ]; + + // Required. The collection of intents to delete. Only intent `name` must be + // filled in. + repeated Intent intents = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// This message is a wrapper around a collection of intents. +message IntentBatch { + // A collection of intents. + repeated Intent intents = 1; +} + +// Represents the options for views of an intent. +// An intent can be a sizable object. Therefore, we provide a resource view that +// does not return training phrases in the response by default. +enum IntentView { + // Training phrases field is not populated in the response. + INTENT_VIEW_UNSPECIFIED = 0; + + // All fields are populated. + INTENT_VIEW_FULL = 1; +} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto new file mode 100644 index 00000000..fe50073b --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto @@ -0,0 +1,278 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "KnowledgeBaseProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [KnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBase]. +service KnowledgeBases { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all knowledge bases of the specified agent. + // + // Note: The `projects.agent.knowledgeBases` resource is deprecated; + // only use `projects.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" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified knowledge base. + // + // Note: The `projects.agent.knowledgeBases` resource is deprecated; + // only use `projects.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/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a knowledge base. + // + // Note: The `projects.agent.knowledgeBases` resource is deprecated; + // only use `projects.knowledgeBases`. + rpc CreateKnowledgeBase(CreateKnowledgeBaseRequest) returns (KnowledgeBase) { + 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" + } + }; + option (google.api.method_signature) = "parent,knowledge_base"; + } + + // Deletes the specified knowledge base. + // + // Note: The `projects.agent.knowledgeBases` resource is deprecated; + // only use `projects.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/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Updates the specified knowledge base. + // + // Note: The `projects.agent.knowledgeBases` resource is deprecated; + // only use `projects.knowledgeBases`. + rpc UpdateKnowledgeBase(UpdateKnowledgeBaseRequest) returns (KnowledgeBase) { + 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" + } + }; + option (google.api.method_signature) = "knowledge_base,update_mask"; + option (google.api.method_signature) = "knowledge_base"; + } +} + +// A knowledge base represents a collection of knowledge documents that you +// provide to Dialogflow. Your knowledge documents contain information that may +// be useful during conversations with end-users. Some Dialogflow features use +// knowledge bases when looking for a response to an end-user input. +// +// For more information, see the [knowledge base +// guide](https://cloud.google.com/dialogflow/docs/how/knowledge-bases). +// +// Note: The `projects.agent.knowledgeBases` resource is deprecated; +// only use `projects.knowledgeBases`. +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//locations//knowledgeBases/`. + string name = 1; + + // Required. The display name of the knowledge base. The name must be 1024 + // bytes or less; otherwise, the creation request fails. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Language which represents the KnowledgeBase. When the KnowledgeBase is + // created/updated, this is populated for all non en-us languages. If not + // populated, the default language en-us applies. + string language_code = 4; +} + +// Request message for [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases]. +message ListKnowledgeBasesRequest { + // Required. The project to list of knowledge bases for. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/KnowledgeBase" + } + ]; + + // The maximum number of items to return in a single page. By + // default 10 and at most 100. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; + + // The filter expression used to filter knowledge bases returned by the list + // method. The expression has the following syntax: + // + // [AND ] ... + // + // The following fields and operators are supported: + // + // * display_name with has(:) operator + // * language_code with equals(=) operator + // + // Examples: + // + // * 'language_code=en-us' matches knowledge bases with en-us language code. + // * 'display_name:articles' matches knowledge bases whose display name + // contains "articles". + // * 'display_name:"Best Articles"' matches knowledge bases whose display + // name contains "Best Articles". + // * 'language_code=en-gb AND display_name=articles' matches all knowledge + // bases whose display name contains "articles" and whose language code is + // "en-gb". + // + // Note: An empty filter string (i.e. "") is a no-op and will result in no + // filtering. + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 4; +} + +// Response message for [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases]. +message ListKnowledgeBasesResponse { + // The list of knowledge bases. + repeated KnowledgeBase knowledge_bases = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// Request message for [KnowledgeBases.GetKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.GetKnowledgeBase]. +message GetKnowledgeBaseRequest { + // Required. The name of the knowledge base to retrieve. + // Format `projects//locations//knowledgeBases/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/KnowledgeBase" + } + ]; +} + +// Request message for [KnowledgeBases.CreateKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.CreateKnowledgeBase]. +message CreateKnowledgeBaseRequest { + // Required. The project to create a knowledge base for. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/KnowledgeBase" + } + ]; + + // Required. The knowledge base to create. + KnowledgeBase knowledge_base = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for [KnowledgeBases.DeleteKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.DeleteKnowledgeBase]. +message DeleteKnowledgeBaseRequest { + // Required. The name of the knowledge base to delete. + // Format: `projects//locations//knowledgeBases/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/KnowledgeBase" + } + ]; + + // Optional. Force deletes the knowledge base. When set to true, any documents + // in the knowledge base are also deleted. + bool force = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [KnowledgeBases.UpdateKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.UpdateKnowledgeBase]. +message UpdateKnowledgeBaseRequest { + // Required. The knowledge base to update. + KnowledgeBase knowledge_base = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Not specified means `update all`. + // Currently, only `display_name` can be updated, an InvalidArgument will be + // returned for attempting to update other fields. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/participant.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/participant.proto new file mode 100644 index 00000000..0078aa1a --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/participant.proto @@ -0,0 +1,1062 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2beta1/audio_config.proto"; +import "google/cloud/dialogflow/v2beta1/gcs.proto"; +import "google/cloud/dialogflow/v2beta1/session.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ParticipantProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Participants][google.cloud.dialogflow.v2beta1.Participant]. +service Participants { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Creates a new participant in a conversation. + rpc CreateParticipant(CreateParticipantRequest) returns (Participant) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/conversations/*}/participants" + body: "participant" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/conversations/*}/participants" + body: "participant" + } + }; + option (google.api.method_signature) = "parent,participant"; + } + + // Retrieves a conversation participant. + rpc GetParticipant(GetParticipantRequest) returns (Participant) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/conversations/*/participants/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/conversations/*/participants/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Returns the list of all participants in the specified conversation. + rpc ListParticipants(ListParticipantsRequest) returns (ListParticipantsResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/conversations/*}/participants" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/conversations/*}/participants" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Updates the specified participant. + rpc UpdateParticipant(UpdateParticipantRequest) returns (Participant) { + option (google.api.http) = { + patch: "/v2beta1/{participant.name=projects/*/conversations/*/participants/*}" + body: "participant" + additional_bindings { + patch: "/v2beta1/{participant.name=projects/*/locations/*/conversations/*/participants/*}" + body: "participant" + } + }; + option (google.api.method_signature) = "participant,update_mask"; + } + + // Adds a text (chat, for example), or audio (phone recording, for example) + // message from a participant into the conversation. + // + // Note: Always use agent versions for production traffic + // sent to virtual agents. See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + rpc AnalyzeContent(AnalyzeContentRequest) returns (AnalyzeContentResponse) { + option (google.api.http) = { + post: "/v2beta1/{participant=projects/*/conversations/*/participants/*}:analyzeContent" + body: "*" + additional_bindings { + post: "/v2beta1/{participant=projects/*/locations/*/conversations/*/participants/*}:analyzeContent" + body: "*" + } + }; + option (google.api.method_signature) = "participant,text_input"; + option (google.api.method_signature) = "participant,event_input"; + } + + // Gets suggested articles for a participant based on specific historical + // messages. + // + // Note that [ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions] will only list the auto-generated + // suggestions, while [CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion] will try to compile suggestion + // based on the provided conversation context in the real time. + rpc SuggestArticles(SuggestArticlesRequest) returns (SuggestArticlesResponse) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestArticles" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestArticles" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Gets suggested faq answers for a participant based on specific historical + // messages. + rpc SuggestFaqAnswers(SuggestFaqAnswersRequest) returns (SuggestFaqAnswersResponse) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Gets smart replies for a participant based on specific historical + // messages. + rpc SuggestSmartReplies(SuggestSmartRepliesRequest) returns (SuggestSmartRepliesResponse) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestSmartReplies" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestSmartReplies" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Deprecated: Use inline suggestion, event based suggestion or + // Suggestion* API instead. + // See [HumanAgentAssistantConfig.name][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.name] for more + // details. + // Removal Date: 2020-09-01. + // + // Retrieves suggestions for live agents. + // + // This method should be used by human agent client software to fetch auto + // generated suggestions in real-time, while the conversation with an end user + // is in progress. The functionality is implemented in terms of the + // [list + // pagination](https://cloud.google.com/apis/design/design_patterns#list_pagination) + // design pattern. The client app should use the `next_page_token` field + // to fetch the next batch of suggestions. `suggestions` are sorted by + // `create_time` in descending order. + // To fetch latest suggestion, just set `page_size` to 1. + // To fetch new suggestions without duplication, send request with filter + // `create_time_epoch_microseconds > [first item's create_time of previous + // request]` and empty page_token. + rpc ListSuggestions(ListSuggestionsRequest) returns (ListSuggestionsResponse) { + option deprecated = true; + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions" + }; + } + + // Deprecated. use [SuggestArticles][google.cloud.dialogflow.v2beta1.Participants.SuggestArticles] and [SuggestFaqAnswers][google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers] instead. + // + // Gets suggestions for a participant based on specific historical + // messages. + // + // Note that [ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions] will only list the auto-generated + // suggestions, while [CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion] will try to compile suggestion + // based on the provided conversation context in the real time. + rpc CompileSuggestion(CompileSuggestionRequest) returns (CompileSuggestionResponse) { + option deprecated = true; + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:compile" + body: "*" + }; + } +} + +// Represents a conversation participant (human agent, virtual agent, end-user). +message Participant { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Participant" + pattern: "projects/{project}/conversations/{conversation}/participants/{participant}" + pattern: "projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}" + }; + + // Enumeration of the roles a participant can play in a conversation. + enum Role { + // Participant role not set. + ROLE_UNSPECIFIED = 0; + + // Participant is a human agent. + HUMAN_AGENT = 1; + + // Participant is an automated agent, such as a Dialogflow agent. + AUTOMATED_AGENT = 2; + + // Participant is an end user that has called or chatted with + // Dialogflow services. + END_USER = 3; + } + + // Optional. The unique identifier of this participant. + // Format: `projects//locations//conversations//participants/`. + string name = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Immutable. The role this participant plays in the conversation. This field must be set + // during participant creation and is then immutable. + Role role = 2 [(google.api.field_behavior) = IMMUTABLE]; + + // Optional. Obfuscated user id that should be associated with the created participant. + // + // You can specify a user id as follows: + // + // 1. If you set this field in + // [CreateParticipantRequest][google.cloud.dialogflow.v2beta1.CreateParticipantRequest.participant] or + // [UpdateParticipantRequest][google.cloud.dialogflow.v2beta1.UpdateParticipantRequest.participant], + // Dialogflow adds the obfuscated user id with the participant. + // + // 2. If you set this field in + // [AnalyzeContent][google.cloud.dialogflow.v2beta1.AnalyzeContentRequest.obfuscated_external_user_id] or + // [StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.obfuscated_external_user_id], + // Dialogflow will update [Participant.obfuscated_external_user_id][google.cloud.dialogflow.v2beta1.Participant.obfuscated_external_user_id]. + // + // Dialogflow uses this user id for following purposes: + // 1) Billing and measurement. If user with the same + // obfuscated_external_user_id is created in a later conversation, dialogflow + // will know it's the same user. 2) Agent assist suggestion personalization. + // For example, Dialogflow can use it to provide personalized smart reply + // suggestions for this user. + // + // Note: + // + // * Please never pass raw user ids to Dialogflow. Always obfuscate your user + // id first. + // * Dialogflow only accepts a UTF-8 encoded string, e.g., a hex digest of a + // hash function like SHA-512. + // * The length of the user id must be <= 256 characters. + string obfuscated_external_user_id = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents a message posted into a conversation. +message Message { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Message" + pattern: "projects/{project}/conversations/{conversation}/messages/{message}" + pattern: "projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}" + }; + + // Optional. The unique identifier of the message. + // Format: `projects//locations//conversations//messages/`. + string name = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The message content. + string content = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The message language. + // This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + // language tag. Example: "en-US". + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The participant that sends this message. + string participant = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The role of the participant. + Participant.Role participant_role = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the message was created in Contact Center AI. + google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The time when the message was sent. + google.protobuf.Timestamp send_time = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The annotation for the message. + MessageAnnotation message_annotation = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The sentiment analysis result for the message. + SentimentAnalysisResult sentiment_analysis = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request message for [Participants.CreateParticipant][google.cloud.dialogflow.v2beta1.Participants.CreateParticipant]. +message CreateParticipantRequest { + // Required. Resource identifier of the conversation adding the participant. + // Format: `projects//locations//conversations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Participant" + } + ]; + + // Required. The participant to create. + Participant participant = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Participants.GetParticipant][google.cloud.dialogflow.v2beta1.Participants.GetParticipant]. +message GetParticipantRequest { + // Required. The name of the participant. Format: + // `projects//locations//conversations//participants/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; +} + +// The request message for [Participants.ListParticipants][google.cloud.dialogflow.v2beta1.Participants.ListParticipants]. +message ListParticipantsRequest { + // Required. The conversation to list all participants from. + // Format: `projects//locations//conversations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Participant" + } + ]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Participants.ListParticipants][google.cloud.dialogflow.v2beta1.Participants.ListParticipants]. +message ListParticipantsResponse { + // The list of participants. There is a maximum number of items + // returned based on the page_size field in the request. + repeated Participant participants = 1; + + // Token to retrieve the next page of results or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [Participants.UpdateParticipant][google.cloud.dialogflow.v2beta1.Participants.UpdateParticipant]. +message UpdateParticipantRequest { + // Required. The participant to update. + Participant participant = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to specify which fields to update. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Represents the natural language speech audio to be played to the end user. +message OutputAudio { + // Required. Instructs the speech synthesizer how to generate the speech + // audio. + OutputAudioConfig config = 1; + + // Required. The natural language speech audio. + bytes audio = 2; +} + +// Represents a response from an automated agent. +message AutomatedAgentReply { + // Represents different automated agent reply types. + enum AutomatedAgentReplyType { + // Not specified. This should never happen. + AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED = 0; + + // Partial reply. e.g. Aggregated responses in a `Fulfillment` that enables + // `return_partial_response` can be returned as partial reply. + // WARNING: partial reply is not eligible for barge-in. + PARTIAL = 1; + + // Final reply. + FINAL = 2; + } + + // Required. + oneof response { + // Response of the Dialogflow [Sessions.DetectIntent][google.cloud.dialogflow.v2beta1.Sessions.DetectIntent] call. + DetectIntentResponse detect_intent_response = 1; + } + + // Response messages from the automated agent. + repeated ResponseMessage response_messages = 3; + + // Info on the query match for the automated agent response. + oneof match { + // Name of the intent if an intent is matched for the query. + // For a V2 query, the value format is `projects//locations/ + // /agent/intents/`. + // For a V3 query, the value format is `projects//locations/ + // /agents//intents/`. + string intent = 4 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Intent" + }]; + + // Event name if an event is triggered for the query. + string event = 5; + } + + // The confidence of the match. Values range from 0.0 (completely uncertain) + // to 1.0 (completely certain). + // This value is for informational purpose only and is only used to help match + // the best intent within the classification threshold. This value may change + // for the same end-user expression at any time due to a model retraining or + // change in implementation. + float match_confidence = 9; + + // The collection of current parameters at the time of this response. + google.protobuf.Struct parameters = 10; + + // The collection of current Dialogflow CX agent session parameters at the + // time of this response. + // Deprecated: Use `parameters` instead. + google.protobuf.Struct cx_session_parameters = 6 [deprecated = true]; + + // AutomatedAgentReply type. + AutomatedAgentReplyType automated_agent_reply_type = 7; + + // Indicates whether the partial automated agent reply is interruptible when a + // later reply message arrives. e.g. if the agent specified some music as + // partial response, it can be cancelled. + bool allow_cancellation = 8; +} + +// The type of Human Agent Assistant API suggestion to perform, and the maximum +// number of results to return for that type. Multiple `Feature` objects can +// be specified in the `features` list. +message SuggestionFeature { + // Defines the type of Human Agent Assistant feature. + enum Type { + // Unspecified feature type. + TYPE_UNSPECIFIED = 0; + + // Run article suggestion model. + ARTICLE_SUGGESTION = 1; + + // Run FAQ model. + FAQ = 2; + + // Run smart reply model. + SMART_REPLY = 3; + } + + // Type of Human Agent Assistant API feature to request. + Type type = 1; +} + +// The request message for [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent]. +message AnalyzeContentRequest { + // Required. The name of the participant this text comes from. + // Format: `projects//locations//conversations//participants/`. + string participant = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; + + // Required. The input content. + oneof input { + // The natural language text to be processed. + TextInput text_input = 6; + + // An input event to send to Dialogflow. + EventInput event_input = 8; + } + + // Speech synthesis configuration. + // The speech synthesis settings for a virtual agent that may be configured + // for the associated conversation profile are not used when calling + // AnalyzeContent. If this configuration is not supplied, speech synthesis + // is disabled. + OutputAudioConfig reply_audio_config = 5; + + // Parameters for a Dialogflow virtual-agent query. + QueryParameters query_params = 9; + + // Optional. The send time of the message from end user or human agent's + // perspective. It is used for identifying the same message under one + // participant. + // + // Given two messages under the same participant: + // - If send time are different regardless of whether the content of the + // messages are exactly the same, the conversation will regard them as + // two distinct messages sent by the participant. + // - If send time is the same regardless of whether the content of the + // messages are exactly the same, the conversation will regard them as + // same message, and ignore the message received later. + // + // If the value is not provided, a new request will always be regarded as a + // new message without any de-duplication. + google.protobuf.Timestamp message_send_time = 10; + + // A unique identifier for this request. Restricted to 36 ASCII characters. + // A random UUID is recommended. + // This request is only idempotent if a `request_id` is provided. + string request_id = 11; +} + +// The message in the response that indicates the parameters of DTMF. +message DtmfParameters { + // Indicates whether DTMF input can be handled in the next request. + bool accepts_dtmf_input = 1; +} + +// The response message for [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent]. +message AnalyzeContentResponse { + // Output only. The output text content. + // This field is set if the automated agent responded with text to show to + // the user. + string reply_text = 1; + + // Optional. The audio data bytes encoded as specified in the request. + // This field is set if: + // + // - `reply_audio_config` was specified in the request, or + // - The automated agent responded with audio to play to the user. In such + // case, `reply_audio.config` contains settings used to synthesize the + // speech. + // + // In some scenarios, multiple output audio fields may be present in the + // response structure. In these cases, only the top-most-level audio output + // has content. + OutputAudio reply_audio = 2; + + // Optional. Only set if a Dialogflow automated agent has responded. + // Note that: [AutomatedAgentReply.detect_intent_response.output_audio][] + // and [AutomatedAgentReply.detect_intent_response.output_audio_config][] + // are always empty, use [reply_audio][google.cloud.dialogflow.v2beta1.AnalyzeContentResponse.reply_audio] instead. + AutomatedAgentReply automated_agent_reply = 3; + + // Output only. Message analyzed by CCAI. + Message message = 5; + + // The suggestions for most recent human agent. The order is the same as + // [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.feature_configs] of + // [HumanAgentAssistantConfig.human_agent_suggestion_config][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.human_agent_suggestion_config]. + repeated SuggestionResult human_agent_suggestion_results = 6; + + // The suggestions for end user. The order is the same as + // [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.feature_configs] of + // [HumanAgentAssistantConfig.end_user_suggestion_config][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.end_user_suggestion_config]. + repeated SuggestionResult end_user_suggestion_results = 7; + + // Indicates the parameters of DTMF. + DtmfParameters dtmf_parameters = 9; +} + +// Represents a part of a message possibly annotated with an entity. The part +// can be an entity or purely a part of the message between two entities or +// message start/end. +message AnnotatedMessagePart { + // Required. A part of a message possibly annotated with an entity. + string text = 1; + + // Optional. The [Dialogflow system entity + // type](https://cloud.google.com/dialogflow/docs/reference/system-entities) + // of this message part. If this is empty, Dialogflow could not annotate the + // phrase part with a system entity. + string entity_type = 2; + + // Optional. The [Dialogflow system entity formatted value + // ](https://cloud.google.com/dialogflow/docs/reference/system-entities) of + // this message part. For example for a system entity of type + // `@sys.unit-currency`, this may contain: + //
+  // {
+  //   "amount": 5,
+  //   "currency": "USD"
+  // }
+  // 
+ google.protobuf.Value formatted_value = 3; +} + +// Represents the result of annotation for the message. +message MessageAnnotation { + // Optional. The collection of annotated message parts ordered by their + // position in the message. You can recover the annotated message by + // concatenating [AnnotatedMessagePart.text]. + repeated AnnotatedMessagePart parts = 1; + + // Required. Indicates whether the text message contains entities. + bool contain_entities = 2; +} + +// Represents article answer. +message ArticleAnswer { + // The article title. + string title = 1; + + // The article URI. + string uri = 2; + + // Output only. Article snippets. + repeated string snippets = 3; + + // A map that contains metadata about the answer and the + // document from which it originates. + map metadata = 5; + + // The name of answer record, in the format of + // "projects//locations//answerRecords/" + string answer_record = 6; +} + +// Represents answer from "frequently asked questions". +message FaqAnswer { + // The piece of text from the `source` knowledge base document. + string answer = 1; + + // The system's confidence score that this Knowledge answer is a good match + // for this conversational query, range from 0.0 (completely uncertain) + // to 1.0 (completely certain). + float confidence = 2; + + // The corresponding FAQ question. + string question = 3; + + // Indicates which Knowledge Document this answer was extracted + // from. + // Format: `projects//locations//agent/knowledgeBases//documents/`. + string source = 4; + + // A map that contains metadata about the answer and the + // document from which it originates. + map metadata = 5; + + // The name of answer record, in the format of + // "projects//locations//answerRecords/" + string answer_record = 6; +} + +// Represents a smart reply answer. +message SmartReplyAnswer { + // The content of the reply. + string reply = 1; + + // Smart reply confidence. + // The system's confidence score that this reply is a good match for + // this conversation, as a value from 0.0 (completely uncertain) to 1.0 + // (completely certain). + float confidence = 2; + + // The name of answer record, in the format of + // "projects//locations//answerRecords/" + string answer_record = 3; +} + +// One response of different type of suggestion response which is used in +// the response of [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] and +// [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent], as well as [HumanAgentAssistantEvent][google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent]. +message SuggestionResult { + // Different type of suggestion response. + oneof suggestion_response { + // Error status if the request failed. + google.rpc.Status error = 1; + + // SuggestArticlesResponse if request is for ARTICLE_SUGGESTION. + SuggestArticlesResponse suggest_articles_response = 2; + + // SuggestFaqAnswersResponse if request is for FAQ_ANSWER. + SuggestFaqAnswersResponse suggest_faq_answers_response = 3; + + // SuggestSmartRepliesResponse if request is for SMART_REPLY. + SuggestSmartRepliesResponse suggest_smart_replies_response = 4; + } +} + +// The request message for [Participants.SuggestArticles][google.cloud.dialogflow.v2beta1.Participants.SuggestArticles]. +message SuggestArticlesRequest { + // Required. The name of the participant to fetch suggestion for. + // Format: `projects//locations//conversations//participants/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; + + // Optional. The name of the latest conversation message to compile suggestion + // for. If empty, it will be the latest message of the conversation. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Message" + } + ]; + + // Optional. Max number of messages prior to and including + // [latest_message][google.cloud.dialogflow.v2beta1.SuggestArticlesRequest.latest_message] to use as context + // when compiling the suggestion. By default 20 and at most 50. + int32 context_size = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Participants.SuggestArticles][google.cloud.dialogflow.v2beta1.Participants.SuggestArticles]. +message SuggestArticlesResponse { + // Output only. Articles ordered by score in descending order. + repeated ArticleAnswer article_answers = 1; + + // The name of the latest conversation message used to compile + // suggestion for. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2; + + // Number of messages prior to and including + // [latest_message][google.cloud.dialogflow.v2beta1.SuggestArticlesResponse.latest_message] to compile the + // suggestion. It may be smaller than the + // [SuggestArticlesResponse.context_size][google.cloud.dialogflow.v2beta1.SuggestArticlesResponse.context_size] field in the request if there + // aren't that many messages in the conversation. + int32 context_size = 3; +} + +// The request message for [Participants.SuggestFaqAnswers][google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers]. +message SuggestFaqAnswersRequest { + // Required. The name of the participant to fetch suggestion for. + // Format: `projects//locations//conversations//participants/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; + + // Optional. The name of the latest conversation message to compile suggestion + // for. If empty, it will be the latest message of the conversation. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Message" + } + ]; + + // Optional. Max number of messages prior to and including + // [latest_message] to use as context when compiling the + // suggestion. By default 20 and at most 50. + int32 context_size = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Participants.SuggestFaqAnswers][google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers]. +message SuggestFaqAnswersResponse { + // Output only. Answers extracted from FAQ documents. + repeated FaqAnswer faq_answers = 1; + + // The name of the latest conversation message used to compile + // suggestion for. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2; + + // Number of messages prior to and including + // [latest_message][google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse.latest_message] to compile the + // suggestion. It may be smaller than the + // [SuggestFaqAnswersRequest.context_size][google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest.context_size] field in the request if there + // aren't that many messages in the conversation. + int32 context_size = 3; +} + +// The request message for [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2beta1.Participants.SuggestSmartReplies]. +message SuggestSmartRepliesRequest { + // Required. The name of the participant to fetch suggestion for. + // Format: `projects//locations//conversations//participants/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; + + // The current natural language text segment to compile suggestion + // for. This provides a way for user to get follow up smart reply suggestion + // after a smart reply selection, without sending a text message. + TextInput current_text_input = 4; + + // The name of the latest conversation message to compile suggestion + // for. If empty, it will be the latest message of the conversation. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Message" + }]; + + // Optional. Max number of messages prior to and including + // [latest_message] to use as context when compiling the + // suggestion. By default 20 and at most 50. + int32 context_size = 3; +} + +// The response message for [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2beta1.Participants.SuggestSmartReplies]. +message SuggestSmartRepliesResponse { + // Output only. Multiple reply options provided by smart reply service. The + // order is based on the rank of the model prediction. + // The maximum number of the returned replies is set in SmartReplyConfig. + repeated SmartReplyAnswer smart_reply_answers = 1; + + // The name of the latest conversation message used to compile + // suggestion for. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2; + + // Number of messages prior to and including + // [latest_message][google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse.latest_message] to compile the + // suggestion. It may be smaller than the + // [SuggestSmartRepliesRequest.context_size][google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest.context_size] field in the request if there + // aren't that many messages in the conversation. + int32 context_size = 3; +} + +// Represents a suggestion for a human agent. +message Suggestion { + option deprecated = true; + + // Represents suggested article. + message Article { + // Output only. The article title. + string title = 1; + + // Output only. The article URI. + string uri = 2; + + // Output only. Article snippets. + repeated string snippets = 3; + + // Output only. A map that contains metadata about the answer and the + // document from which it originates. + map metadata = 5; + + // Output only. The name of answer record, in the format of + // "projects//locations//answerRecords/" + string answer_record = 6; + } + + // Represents suggested answer from "frequently asked questions". + message FaqAnswer { + // Output only. The piece of text from the `source` knowledge base document. + string answer = 1; + + // The system's confidence score that this Knowledge answer is a good match + // for this conversational query, range from 0.0 (completely uncertain) + // to 1.0 (completely certain). + float confidence = 2; + + // Output only. The corresponding FAQ question. + string question = 3; + + // Output only. Indicates which Knowledge Document this answer was extracted + // from. + // Format: `projects//locations//agent/knowledgeBases//documents/`. + string source = 4; + + // Output only. A map that contains metadata about the answer and the + // document from which it originates. + map metadata = 5; + + // Output only. The name of answer record, in the format of + // "projects//locations//answerRecords/" + string answer_record = 6; + } + + // Output only. The name of this suggestion. + // Format: + // `projects//locations//conversations//participants/*/suggestions/`. + string name = 1; + + // Output only. Articles ordered by score in descending order. + repeated Article articles = 2; + + // Output only. Answers extracted from FAQ documents. + repeated FaqAnswer faq_answers = 4; + + // Output only. The time the suggestion was created. + google.protobuf.Timestamp create_time = 5; + + // Output only. Latest message used as context to compile this suggestion. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 7; +} + +// The request message for [Participants.ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions]. +message ListSuggestionsRequest { + option deprecated = true; + + // Required. The name of the participant to fetch suggestions for. + // Format: `projects//locations//conversations//participants/`. + string parent = 1; + + // Optional. The maximum number of items to return in a single page. The + // default value is 100; the maximum value is 1000. + int32 page_size = 2; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3; + + // Optional. Filter on suggestions fields. Currently predicates on + // `create_time` and `create_time_epoch_microseconds` are supported. + // `create_time` only support milliseconds accuracy. E.g., + // `create_time_epoch_microseconds > 1551790877964485` or + // `create_time > "2017-01-15T01:30:15.01Z"` + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 4; +} + +// The response message for [Participants.ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions]. +message ListSuggestionsResponse { + option deprecated = true; + + // Required. The list of suggestions. There will be a maximum number of items + // returned based on the page_size field in the request. `suggestions` is + // sorted by `create_time` in descending order. + repeated Suggestion suggestions = 1; + + // Optional. Token to retrieve the next page of results or empty if there are + // no more results in the list. + string next_page_token = 2; +} + +// The request message for [Participants.CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion]. +message CompileSuggestionRequest { + option deprecated = true; + + // Required. The name of the participant to fetch suggestion for. + // Format: `projects//locations//conversations//participants/`. + string parent = 1; + + // Optional. The name of the latest conversation message to compile suggestion + // for. If empty, it will be the latest message of the conversation. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2; + + // Optional. Max number of messages prior to and including + // [latest_message] to use as context when compiling the + // suggestion. If zero or less than zero, 20 is used. + int32 context_size = 3; +} + +// The response message for [Participants.CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion]. +message CompileSuggestionResponse { + option deprecated = true; + + // The compiled suggestion. + Suggestion suggestion = 1; + + // The name of the latest conversation message used to compile + // suggestion for. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2; + + // Number of messages prior to and including + // [latest_message][google.cloud.dialogflow.v2beta1.CompileSuggestionResponse.latest_message] + // to compile the suggestion. It may be smaller than the + // [CompileSuggestionRequest.context_size][google.cloud.dialogflow.v2beta1.CompileSuggestionRequest.context_size] field in the request if + // there aren't that many messages in the conversation. + int32 context_size = 3; +} + +// Response messages from an automated agent. +message ResponseMessage { + // The text response message. + message Text { + // A collection of text responses. + repeated string text = 1; + } + + // Indicates that the conversation should be handed off to a human agent. + // + // Dialogflow only uses this to determine which conversations were handed off + // to a human agent for measurement purposes. What else to do with this signal + // is up to you and your handoff procedures. + // + // You may set this, for example: + // * In the entry fulfillment of a CX Page if entering the page indicates + // something went extremely wrong in the conversation. + // * In a webhook response when you determine that the customer issue can only + // be handled by a human. + message LiveAgentHandoff { + // Custom metadata for your handoff procedure. Dialogflow doesn't impose + // any structure on this. + google.protobuf.Struct metadata = 1; + } + + // Indicates that interaction with the Dialogflow agent has ended. + message EndInteraction { + + } + + // Required. The rich response message. + oneof message { + // Returns a text response. + Text text = 1; + + // Returns a response containing a custom, platform-specific payload. + google.protobuf.Struct payload = 2; + + // Hands off conversation to a live agent. + LiveAgentHandoff live_agent_handoff = 3; + + // A signal that indicates the interaction with the Dialogflow agent has + // ended. + EndInteraction end_interaction = 4; + } +} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/session.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/session.proto new file mode 100644 index 00000000..6a5a67cd --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/session.proto @@ -0,0 +1,812 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2beta1/agent.proto"; +import "google/cloud/dialogflow/v2beta1/audio_config.proto"; +import "google/cloud/dialogflow/v2beta1/context.proto"; +import "google/cloud/dialogflow/v2beta1/gcs.proto"; +import "google/cloud/dialogflow/v2beta1/intent.proto"; +import "google/cloud/dialogflow/v2beta1/session_entity_type.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/rpc/status.proto"; +import "google/type/latlng.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "SessionProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; +option (google.api.resource_definition) = { + type: "dialogflow.googleapis.com/Session" + pattern: "projects/{project}/agent/sessions/{session}" + pattern: "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}" + pattern: "projects/{project}/locations/{location}/agent/sessions/{session}" + pattern: "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}" +}; + +// A service used for session interactions. +// +// For more information, see the [API interactions +// guide](https://cloud.google.com/dialogflow/docs/api-overview). +service Sessions { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Processes a natural language query and returns structured, actionable data + // as a result. This method is not idempotent, because it may cause contexts + // and session entity types to be updated, which in turn might affect + // results of future queries. + // + // 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" + body: "*" + additional_bindings { + post: "/v2beta1/{session=projects/*/agent/environments/*/users/*/sessions/*}:detectIntent" + body: "*" + } + additional_bindings { + post: "/v2beta1/{session=projects/*/locations/*/agent/sessions/*}:detectIntent" + body: "*" + } + additional_bindings { + post: "/v2beta1/{session=projects/*/locations/*/agent/environments/*/users/*/sessions/*}:detectIntent" + body: "*" + } + }; + option (google.api.method_signature) = "session,query_input"; + } + + // 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) { + } +} + +// The request to detect user's intent. +message DetectIntentRequest { + // Required. The name of the session this query is sent to. Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment + // (`Environment ID` might be referred to as environment name at some places). + // If `User ID` is not specified, we are using "-". It's up to the API caller + // to choose an appropriate `Session ID` and `User Id`. They can be a random + // number or some type of user and session identifiers (preferably hashed). + // 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) = { + type: "dialogflow.googleapis.com/Session" + } + ]; + + // The parameters of this query. + QueryParameters query_params = 2; + + // Required. The input specification. It can be set to: + // + // 1. an audio config + // which instructs the speech recognizer how to process the speech audio, + // + // 2. a conversational query in the form of text, or + // + // 3. an event that specifies which intent to trigger. + QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; + + // Instructs the speech synthesizer how to generate the output + // audio. If this field is not set and agent-level speech synthesizer is not + // configured, no output audio is generated. + OutputAudioConfig output_audio_config = 4; + + // Mask for [output_audio_config][google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config] indicating which settings in this + // request-level config should override speech synthesizer settings defined at + // agent-level. + // + // If unspecified or empty, [output_audio_config][google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config] replaces the agent-level + // config in its entirety. + google.protobuf.FieldMask output_audio_config_mask = 7; + + // The natural language speech audio to be processed. This field + // should be populated iff `query_input` is set to an input audio config. + // A single request can contain up to 1 minute of speech audio data. + bytes input_audio = 5; +} + +// The message returned from the DetectIntent method. +message DetectIntentResponse { + // The unique identifier of the response. It can be used to + // locate a response in the training example set or for reporting issues. + string response_id = 1; + + // The selected results of the conversational query or event processing. + // See `alternative_query_results` for additional potential results. + QueryResult query_result = 2; + + // If Knowledge Connectors are enabled, there could be more than one result + // returned for a given query or event, and this field will contain all + // results except for the top one, which is captured in query_result. The + // alternative results are ordered by decreasing + // `QueryResult.intent_detection_confidence`. If Knowledge Connectors are + // disabled, this field will be empty until multiple responses for regular + // intents are supported, at which point those additional results will be + // surfaced here. + repeated QueryResult alternative_query_results = 5; + + // Specifies the status of the webhook request. + google.rpc.Status webhook_status = 3; + + // The audio data bytes encoded as specified in the request. + // Note: The output audio is generated based on the values of default platform + // text responses found in the `query_result.fulfillment_messages` field. If + // multiple default text responses exist, they will be concatenated when + // generating audio. If no default platform text responses exist, the + // generated audio content will be empty. + // + // In some scenarios, multiple output audio fields may be present in the + // response structure. In these cases, only the top-most-level audio output + // has content. + bytes output_audio = 4; + + // The config used by the speech synthesizer to generate the output audio. + OutputAudioConfig output_audio_config = 6; +} + +// Represents the parameters of the conversational query. +message QueryParameters { + // The time zone of this conversational query from the + // [time zone database](https://www.iana.org/time-zones), e.g., + // America/New_York, Europe/Paris. If not provided, the time zone specified in + // agent settings is used. + string time_zone = 1; + + // The geo location of this conversational query. + google.type.LatLng geo_location = 2; + + // The collection of contexts to be activated before this query is + // executed. + repeated Context contexts = 3; + + // Specifies whether to delete all contexts in the current session + // before the new ones are activated. + bool reset_contexts = 4; + + // Additional session entity types to replace or extend developer + // entity types with. The entity synonyms apply to all languages and persist + // for the session of this query. + repeated SessionEntityType session_entity_types = 5; + + // This field can be used to pass custom data to your webhook. + // Arbitrary JSON objects are supported. + // If supplied, the value is used to populate the + // `WebhookRequest.original_detect_intent_request.payload` + // field sent to your webhook. + google.protobuf.Struct payload = 6; + + // KnowledgeBases to get alternative results from. If not set, the + // KnowledgeBases enabled in the agent (through UI) will be used. + // Format: `projects//knowledgeBases/`. + repeated string knowledge_base_names = 12; + + // Configures the type of sentiment analysis to perform. If not + // provided, sentiment analysis is not performed. + // Note: Sentiment Analysis is only currently available for Essentials Edition + // agents. + SentimentAnalysisRequestConfig sentiment_analysis_request_config = 10; + + // For mega agent query, directly specify which sub agents to query. + // If any specified sub agent is not linked to the mega agent, an error will + // be returned. If empty, Dialogflow will decide which sub agents to query. + // If specified for a non-mega-agent query, will be silently ignored. + 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 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. + // Google's specified headers are not allowed. Including: "Host", + // "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding", + // "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc. + map webhook_headers = 14; +} + +// Represents the query input. It can contain either: +// +// 1. An audio config which +// instructs the speech recognizer how to process the speech audio. +// +// 2. A conversational query in the form of text. +// +// 3. An event that specifies which intent to trigger. +message QueryInput { + // Required. The input specification. + oneof input { + // Instructs the speech recognizer how to process the speech audio. + InputAudioConfig audio_config = 1; + + // The natural language text to be processed. + TextInput text = 2; + + // The event to be processed. + EventInput event = 3; + + // The DTMF digits used to invoke intent and fill in parameter value. + TelephonyDtmfEvents dtmf = 4; + } +} + +// Represents the result of conversational query or event processing. +message QueryResult { + // The original conversational query text: + // + // - If natural language text was provided as input, `query_text` contains + // a copy of the input. + // - If natural language speech audio was provided as input, `query_text` + // contains the speech recognition result. If speech recognizer produced + // multiple alternatives, a particular one is picked. + // - If automatic spell correction is enabled, `query_text` will contain the + // corrected user input. + string query_text = 1; + + // The language that was triggered during intent detection. + // See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. + string language_code = 15; + + // The Speech recognition confidence between 0.0 and 1.0. A higher number + // indicates an estimated greater likelihood that the recognized words are + // correct. The default of 0.0 is a sentinel value indicating that confidence + // was not set. + // + // This field is not guaranteed to be accurate or set. In particular this + // field isn't set for StreamingDetectIntent since the streaming endpoint has + // separate confidence estimates per portion of the audio in + // StreamingRecognitionResult. + float speech_recognition_confidence = 2; + + // The action name from the matched intent. + string action = 3; + + // The collection of extracted parameters. + // + // Depending on your protocol or client library language, this is a + // map, associative array, symbol table, dictionary, or JSON object + // composed of a collection of (MapKey, MapValue) pairs: + // + // - MapKey type: string + // - MapKey value: parameter name + // - MapValue type: + // - If parameter's entity type is a composite entity: map + // - Else: depending on parameter value type, could be one of string, + // number, boolean, null, list or map + // - MapValue value: + // - If parameter's entity type is a composite entity: + // map from composite entity property names to property values + // - Else: parameter value + google.protobuf.Struct parameters = 4; + + // This field is set to: + // + // - `false` if the matched intent has required parameters and not all of + // the required parameter values have been collected. + // - `true` if all required parameter values have been collected, or if the + // matched intent doesn't contain any required parameters. + bool all_required_params_present = 5; + + // Indicates whether the conversational query triggers a cancellation for slot + // filling. + bool cancels_slot_filling = 21; + + // The text to be pronounced to the user or shown on the screen. + // Note: This is a legacy field, `fulfillment_messages` should be preferred. + string fulfillment_text = 6; + + // The collection of rich messages to present to the user. + repeated Intent.Message fulfillment_messages = 7; + + // If the query was fulfilled by a webhook call, this field is set to the + // value of the `source` field returned in the webhook response. + string webhook_source = 8; + + // If the query was fulfilled by a webhook call, this field is set to the + // value of the `payload` field returned in the webhook response. + google.protobuf.Struct webhook_payload = 9; + + // The collection of output contexts. If applicable, + // `output_contexts.parameters` contains entries with name + // `.original` containing the original parameter values + // before the query. + repeated Context output_contexts = 10; + + // The intent that matched the conversational query. Some, not + // all fields are filled in this message, including but not limited to: + // `name`, `display_name`, `end_interaction` and `is_fallback`. + Intent intent = 11; + + // The intent detection confidence. Values range from 0.0 + // (completely uncertain) to 1.0 (completely certain). + // This value is for informational purpose only and is only used to + // help match the best intent within the classification threshold. + // This value may change for the same end-user expression at any time due to a + // model retraining or change in implementation. + // If there are `multiple knowledge_answers` messages, this value is set to + // the greatest `knowledgeAnswers.match_confidence` value in the list. + float intent_detection_confidence = 12; + + // Free-form diagnostic information for the associated detect intent request. + // The fields of this data can change without notice, so you should not write + // code that depends on its structure. + // The data may contain: + // + // - webhook call latency + // - webhook errors + google.protobuf.Struct diagnostic_info = 14; + + // The sentiment analysis result, which depends on the + // `sentiment_analysis_request_config` specified in the request. + SentimentAnalysisResult sentiment_analysis_result = 17; + + // The result from Knowledge Connector (if any), ordered by decreasing + // `KnowledgeAnswers.match_confidence`. + KnowledgeAnswers knowledge_answers = 18; +} + +// Represents the result of querying a Knowledge base. +message KnowledgeAnswers { + // An answer from Knowledge Connector. + message Answer { + // Represents the system's confidence that this knowledge answer is a good + // match for this conversational query. + enum MatchConfidenceLevel { + // Not specified. + MATCH_CONFIDENCE_LEVEL_UNSPECIFIED = 0; + + // Indicates that the confidence is low. + LOW = 1; + + // Indicates our confidence is medium. + MEDIUM = 2; + + // Indicates our confidence is high. + HIGH = 3; + } + + // Indicates which Knowledge Document this answer was extracted from. + // Format: `projects//knowledgeBases//documents/`. + string source = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + }]; + + // The corresponding FAQ question if the answer was extracted from a FAQ + // Document, empty otherwise. + string faq_question = 2; + + // The piece of text from the `source` knowledge base document that answers + // this conversational query. + string answer = 3; + + // The system's confidence level that this knowledge answer is a good match + // for this conversational query. + // NOTE: The confidence level for a given `` pair may change + // without notice, as it depends on models that are constantly being + // improved. However, it will change less frequently than the confidence + // score below, and should be preferred for referencing the quality of an + // answer. + MatchConfidenceLevel match_confidence_level = 4; + + // The system's confidence score that this Knowledge answer is a good match + // for this conversational query. + // The range is from 0.0 (completely uncertain) to 1.0 (completely certain). + // Note: The confidence score is likely to vary somewhat (possibly even for + // identical requests), as the underlying model is under constant + // improvement. It may be deprecated in the future. We recommend using + // `match_confidence_level` which should be generally more stable. + float match_confidence = 5; + } + + // A list of answers from Knowledge Connector. + repeated Answer answers = 1; +} + +// The top-level message sent by the client to the +// [Sessions.StreamingDetectIntent][google.cloud.dialogflow.v2beta1.Sessions.StreamingDetectIntent] method. +// +// Multiple request messages should be sent in order: +// +// 1. The first message must contain +// [session][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.session], +// [query_input][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_input] plus optionally +// [query_params][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_params]. If the client +// wants to receive an audio response, it should also contain +// [output_audio_config][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config]. +// The message must not contain +// [input_audio][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.input_audio]. +// 2. If [query_input][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_input] was set to +// [query_input.audio_config][google.cloud.dialogflow.v2beta1.InputAudioConfig], all subsequent +// messages must contain +// [input_audio][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.input_audio] to continue with +// Speech recognition. +// If you decide to rather detect an intent from text input after you +// already started Speech recognition, please send a message with +// [query_input.text][google.cloud.dialogflow.v2beta1.QueryInput.text]. +// +// However, note that: +// +// * Dialogflow will bill you for the audio duration so far. +// * Dialogflow discards all Speech recognition results in favor of the +// input text. +// * Dialogflow will use the language code from the first message. +// +// After you sent all input, you must half-close or abort the request stream. +message StreamingDetectIntentRequest { + // Required. The name of the session the query is sent to. + // Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we are using "-". It's up to the API caller + // to choose an appropriate `Session ID` and `User Id`. They can be a random + // number or some type of user and session identifiers (preferably hashed). + // 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) = { + type: "dialogflow.googleapis.com/Session" + } + ]; + + // The parameters of this query. + QueryParameters query_params = 2; + + // Required. The input specification. It can be set to: + // + // 1. an audio config which instructs the speech recognizer how to process + // the speech audio, + // + // 2. a conversational query in the form of text, or + // + // 3. an event that specifies which intent to trigger. + QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; + + // DEPRECATED. Please use [InputAudioConfig.single_utterance][google.cloud.dialogflow.v2beta1.InputAudioConfig.single_utterance] instead. + // If `false` (default), recognition does not cease until the + // client closes the stream. + // If `true`, the recognizer will detect a single spoken utterance in input + // audio. Recognition ceases when it detects the audio's voice has + // stopped or paused. In this case, once a detected intent is received, the + // client should close the stream and start a new request with a new stream as + // needed. + // This setting is ignored when `query_input` is a piece of text or an event. + bool single_utterance = 4 [deprecated = true]; + + // Instructs the speech synthesizer how to generate the output + // audio. If this field is not set and agent-level speech synthesizer is not + // configured, no output audio is generated. + OutputAudioConfig output_audio_config = 5; + + // Mask for [output_audio_config][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config] indicating which settings in this + // request-level config should override speech synthesizer settings defined at + // agent-level. + // + // If unspecified or empty, [output_audio_config][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config] replaces the agent-level + // config in its entirety. + google.protobuf.FieldMask output_audio_config_mask = 7; + + // The input audio content to be recognized. Must be sent if + // `query_input` was set to a streaming input audio config. The complete audio + // over all streaming messages must not exceed 1 minute. + bytes input_audio = 6; +} + +// The top-level message returned from the +// `StreamingDetectIntent` method. +// +// Multiple response messages can be returned in order: +// +// 1. If the input was set to streaming audio, the first one or more messages +// contain `recognition_result`. Each `recognition_result` represents a more +// complete transcript of what the user said. The last `recognition_result` +// has `is_final` set to `true`. +// +// 2. The next message contains `response_id`, `query_result`, +// `alternative_query_results` and optionally `webhook_status` if a WebHook +// was called. +// +// 3. If `output_audio_config` was specified in the request or agent-level +// speech synthesizer is configured, all subsequent messages contain +// `output_audio` and `output_audio_config`. +message StreamingDetectIntentResponse { + // The unique identifier of the response. It can be used to + // locate a response in the training example set or for reporting issues. + string response_id = 1; + + // The result of speech recognition. + StreamingRecognitionResult recognition_result = 2; + + // The selected results of the conversational query or event processing. + // See `alternative_query_results` for additional potential results. + QueryResult query_result = 3; + + // If Knowledge Connectors are enabled, there could be more than one result + // returned for a given query or event, and this field will contain all + // results except for the top one, which is captured in query_result. The + // alternative results are ordered by decreasing + // `QueryResult.intent_detection_confidence`. If Knowledge Connectors are + // disabled, this field will be empty until multiple responses for regular + // intents are supported, at which point those additional results will be + // surfaced here. + repeated QueryResult alternative_query_results = 7; + + // Specifies the status of the webhook request. + google.rpc.Status webhook_status = 4; + + // The audio data bytes encoded as specified in the request. + // Note: The output audio is generated based on the values of default platform + // text responses found in the `query_result.fulfillment_messages` field. If + // multiple default text responses exist, they will be concatenated when + // generating audio. If no default platform text responses exist, the + // generated audio content will be empty. + // + // In some scenarios, multiple output audio fields may be present in the + // response structure. In these cases, only the top-most-level audio output + // has content. + bytes output_audio = 5; + + // The config used by the speech synthesizer to generate the output audio. + OutputAudioConfig output_audio_config = 6; +} + +// Contains a speech recognition result corresponding to a portion of the audio +// that is currently being processed or an indication that this is the end +// of the single requested utterance. +// +// Example: +// +// 1. transcript: "tube" +// +// 2. transcript: "to be a" +// +// 3. transcript: "to be" +// +// 4. transcript: "to be or not to be" +// is_final: true +// +// 5. transcript: " that's" +// +// 6. transcript: " that is" +// +// 7. message_type: `END_OF_SINGLE_UTTERANCE` +// +// 8. transcript: " that is the question" +// is_final: true +// +// Only two of the responses contain final results (#4 and #8 indicated by +// `is_final: true`). Concatenating these generates the full transcript: "to be +// or not to be that is the question". +// +// In each response we populate: +// +// * for `TRANSCRIPT`: `transcript` and possibly `is_final`. +// +// * for `END_OF_SINGLE_UTTERANCE`: only `message_type`. +message StreamingRecognitionResult { + // Type of the response message. + enum MessageType { + // Not specified. Should never be used. + MESSAGE_TYPE_UNSPECIFIED = 0; + + // Message contains a (possibly partial) transcript. + TRANSCRIPT = 1; + + // Message contains DTMF digits. When the client gets the message, it + // should stop sending additional data, half-close the gRPC connection, and + // wait for any additional results until the server closes the gRPC. + // connection. + DTMF_DIGITS = 3; + + // Event indicates that the server has detected the end of the user's speech + // utterance and expects no additional speech. Therefore, the server will + // not process additional audio (although it may subsequently return + // additional results). The client should stop sending additional audio + // data, half-close the gRPC connection, and wait for any additional results + // until the server closes the gRPC connection. This message is only sent if + // `single_utterance` was set to `true`, and is not used otherwise. + END_OF_SINGLE_UTTERANCE = 2; + + // Message contains DTMF digits. Before a message with DTMF_DIGITS is sent, + // a message with PARTIAL_DTMF_DIGITS may be sent with DTMF digits collected + // up to the time of sending, which represents an intermediate result. + PARTIAL_DTMF_DIGITS = 4; + } + + // Type of the result message. + MessageType message_type = 1; + + // Transcript text representing the words that the user spoke. + // Populated if and only if `message_type` = `TRANSCRIPT`. + string transcript = 2; + + // If `false`, the `StreamingRecognitionResult` represents an + // interim result that may change. If `true`, the recognizer will not return + // any further hypotheses about this piece of the audio. May only be populated + // for `message_type` = `TRANSCRIPT`. + bool is_final = 3; + + // The Speech confidence between 0.0 and 1.0 for the current portion of audio. + // A higher number indicates an estimated greater likelihood that the + // recognized words are correct. The default of 0.0 is a sentinel value + // indicating that confidence was not set. + // + // This field is typically only provided if `is_final` is true and you should + // not rely on it being accurate or even set. + float confidence = 4; + + // An estimate of the likelihood that the speech recognizer will + // not change its guess about this interim recognition result: + // + // * If the value is unspecified or 0.0, Dialogflow didn't compute the + // stability. In particular, Dialogflow will only provide stability for + // `TRANSCRIPT` results with `is_final = false`. + // * Otherwise, the value is in (0.0, 1.0] where 0.0 means completely + // unstable and 1.0 means completely stable. + float stability = 6; + + // Word-specific information for the words recognized by Speech in + // [transcript][google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.transcript]. Populated if and only if `message_type` = `TRANSCRIPT` and + // [InputAudioConfig.enable_word_info] is set. + repeated SpeechWordInfo speech_word_info = 7; + + // Time offset of the end of this Speech recognition result relative to the + // beginning of the audio. Only populated for `message_type` = `TRANSCRIPT`. + google.protobuf.Duration speech_end_offset = 8; + + // DTMF digits. Populated if and only if `message_type` = `DTMF_DIGITS`. + TelephonyDtmfEvents dtmf_digits = 5; +} + +// Represents the natural language text to be processed. +message TextInput { + // Required. The UTF-8 encoded natural language text to be processed. + // Text length must not exceed 256 characters. + string text = 1; + + // Required. The language of this conversational query. See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. Note that queries in + // the same session do not necessarily need to specify the same language. + string language_code = 2; +} + +// Events allow for matching intents by event name instead of the natural +// language input. For instance, input `` can trigger a personalized welcome response. +// The parameter `name` may be used by the agent in the response: +// `"Hello #welcome_event.name! What can I do for you today?"`. +message EventInput { + // Required. The unique identifier of the event. + string name = 1; + + // The collection of parameters associated with the event. + // + // Depending on your protocol or client library language, this is a + // map, associative array, symbol table, dictionary, or JSON object + // composed of a collection of (MapKey, MapValue) pairs: + // + // - MapKey type: string + // - MapKey value: parameter name + // - MapValue type: + // - If parameter's entity type is a composite entity: map + // - Else: depending on parameter value type, could be one of string, + // number, boolean, null, list or map + // - MapValue value: + // - If parameter's entity type is a composite entity: + // map from composite entity property names to property values + // - Else: parameter value + google.protobuf.Struct parameters = 2; + + // Required. The language of this query. See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. Note that queries in + // the same session do not necessarily need to specify the same language. + string language_code = 3; +} + +// Configures the types of sentiment analysis to perform. +message SentimentAnalysisRequestConfig { + // Instructs the service to perform sentiment analysis on + // `query_text`. If not provided, sentiment analysis is not performed on + // `query_text`. + bool analyze_query_text_sentiment = 1; +} + +// The result of sentiment analysis. Sentiment analysis inspects user input +// and identifies the prevailing subjective opinion, especially to determine a +// user's attitude as positive, negative, or neutral. +// For [Participants.DetectIntent][], it needs to be configured in +// [DetectIntentRequest.query_params][google.cloud.dialogflow.v2beta1.DetectIntentRequest.query_params]. For +// [Participants.StreamingDetectIntent][], it needs to be configured in +// [StreamingDetectIntentRequest.query_params][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_params]. +// And for [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] and +// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent], it needs to be configured in +// [ConversationProfile.human_agent_assistant_config][google.cloud.dialogflow.v2beta1.ConversationProfile.human_agent_assistant_config] +message SentimentAnalysisResult { + // The sentiment analysis result for `query_text`. + Sentiment query_text_sentiment = 1; +} + +// The sentiment, such as positive/negative feeling or association, for a unit +// of analysis, such as the query text. +message Sentiment { + // Sentiment score between -1.0 (negative sentiment) and 1.0 (positive + // sentiment). + float score = 1; + + // A non-negative number in the [0, +inf) range, which represents the absolute + // magnitude of sentiment, regardless of score (positive or negative). + float magnitude = 2; +} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto new file mode 100644 index 00000000..c38902b3 --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto @@ -0,0 +1,351 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2beta1/entity_type.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "SessionEntityTypeProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [SessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityType]. +service SessionEntityTypes { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all session entity types in the specified session. + // + // This method doesn't work with Google Assistant integration. + // Contact Dialogflow support if you need to use session entities + // with Google Assistant integration. + rpc ListSessionEntityTypes(ListSessionEntityTypesRequest) returns (ListSessionEntityTypesResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/agent/sessions/*}/entityTypes" + additional_bindings { + get: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes" + } + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/entityTypes" + } + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified session entity type. + // + // This method doesn't work with Google Assistant integration. + // Contact Dialogflow support if you need to use session entities + // with Google Assistant integration. + rpc GetSessionEntityType(GetSessionEntityTypeRequest) returns (SessionEntityType) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/agent/sessions/*/entityTypes/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + } + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" + } + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a session entity type. + // + // If the specified session entity type already exists, overrides the + // session entity type. + // + // This method doesn't work with Google Assistant integration. + // Contact Dialogflow support if you need to use session entities + // with Google Assistant integration. + rpc CreateSessionEntityType(CreateSessionEntityTypeRequest) returns (SessionEntityType) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent/sessions/*}/entityTypes" + body: "session_entity_type" + additional_bindings { + post: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes" + body: "session_entity_type" + } + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/entityTypes" + body: "session_entity_type" + } + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes" + body: "session_entity_type" + } + }; + option (google.api.method_signature) = "parent,session_entity_type"; + } + + // Updates the specified session entity type. + // + // This method doesn't work with Google Assistant integration. + // Contact Dialogflow support if you need to use session entities + // with Google Assistant integration. + rpc UpdateSessionEntityType(UpdateSessionEntityTypeRequest) returns (SessionEntityType) { + option (google.api.http) = { + patch: "/v2beta1/{session_entity_type.name=projects/*/agent/sessions/*/entityTypes/*}" + body: "session_entity_type" + additional_bindings { + patch: "/v2beta1/{session_entity_type.name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + body: "session_entity_type" + } + additional_bindings { + patch: "/v2beta1/{session_entity_type.name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" + body: "session_entity_type" + } + additional_bindings { + patch: "/v2beta1/{session_entity_type.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + body: "session_entity_type" + } + }; + option (google.api.method_signature) = "session_entity_type"; + option (google.api.method_signature) = "session_entity_type,update_mask"; + } + + // Deletes the specified session entity type. + // + // This method doesn't work with Google Assistant integration. + // Contact Dialogflow support if you need to use session entities + // with Google Assistant integration. + rpc DeleteSessionEntityType(DeleteSessionEntityTypeRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta1/{name=projects/*/agent/sessions/*/entityTypes/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + } + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" + } + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + } + }; + option (google.api.method_signature) = "name"; + } +} + +// A session represents a conversation between a Dialogflow agent and an +// end-user. You can create special entities, called session entities, during a +// session. Session entities can extend or replace custom entity types and only +// exist during the session that they were created for. All session data, +// including session entities, is stored by Dialogflow for 20 minutes. +// +// For more information, see the [session entity +// guide](https://cloud.google.com/dialogflow/docs/entities-session). +message SessionEntityType { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/SessionEntityType" + pattern: "projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}" + pattern: "projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}" + pattern: "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}" + pattern: "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}" + }; + + // The types of modifications for a session entity type. + enum EntityOverrideMode { + // Not specified. This value should be never used. + ENTITY_OVERRIDE_MODE_UNSPECIFIED = 0; + + // The collection of session entities overrides the collection of entities + // in the corresponding custom entity type. + ENTITY_OVERRIDE_MODE_OVERRIDE = 1; + + // The collection of session entities extends the collection of entities in + // the corresponding custom entity type. + // + // Note: Even in this override mode calls to `ListSessionEntityTypes`, + // `GetSessionEntityType`, `CreateSessionEntityType` and + // `UpdateSessionEntityType` only return the additional entities added in + // this session entity type. If you want to get the supplemented list, + // please call [EntityTypes.GetEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType] on the custom entity type + // and merge. + ENTITY_OVERRIDE_MODE_SUPPLEMENT = 2; + } + + // Required. The unique identifier of this session entity type. Supported + // formats: + // - `projects//agent/sessions//entityTypes/` + // - `projects//locations//agent/sessions//entityTypes/` + // - `projects//agent/environments//users//sessions//entityTypes/` + // - `projects//locations//agent/environments/ + // /users//sessions//entityTypes/` + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. + // `` must be the display name of an existing entity + // type in the same agent that will be overridden or supplemented. + string name = 1; + + // Required. Indicates whether the additional data should override or + // supplement the custom entity type definition. + EntityOverrideMode entity_override_mode = 2; + + // Required. The collection of entities associated with this session entity + // type. + repeated EntityType.Entity entities = 3; +} + +// The request message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes]. +message ListSessionEntityTypesRequest { + // Required. The session to list all session entity types from. + // Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/SessionEntityType" + } + ]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// The response message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes]. +message ListSessionEntityTypesResponse { + // The list of session entity types. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated SessionEntityType session_entity_types = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [SessionEntityTypes.GetSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityType]. +message GetSessionEntityTypeRequest { + // Required. The name of the session entity type. Supported formats: + // - `projects//agent/sessions//entityTypes/` + // - `projects//locations//agent/sessions//entityTypes/` + // - `projects//agent/environments//users//sessions//entityTypes/` + // - `projects//locations//agent/environments/ + // /users//sessions//entityTypes/` + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/SessionEntityType" + } + ]; +} + +// The request message for [SessionEntityTypes.CreateSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityType]. +message CreateSessionEntityTypeRequest { + // Required. The session to create a session entity type for. + // Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/SessionEntityType" + } + ]; + + // Required. The session entity type to create. + SessionEntityType session_entity_type = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [SessionEntityTypes.UpdateSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.UpdateSessionEntityType]. +message UpdateSessionEntityTypeRequest { + // Required. The session entity type to update. + SessionEntityType session_entity_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2; +} + +// The request message for [SessionEntityTypes.DeleteSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityType]. +message DeleteSessionEntityTypeRequest { + // Required. The name of the entity type to delete. + // Supported formats: + // - `projects//agent/sessions//entityTypes/` + // - `projects//locations//agent/sessions//entityTypes/` + // - `projects//agent/environments//users//sessions//entityTypes/` + // - `projects//locations//agent/environments/ + // /users//sessions//entityTypes/` + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/SessionEntityType" + } + ]; +} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/validation_result.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/validation_result.proto new file mode 100644 index 00000000..2daeaf32 --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/validation_result.proto @@ -0,0 +1,76 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ValidationResultProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Represents a single validation error. +message ValidationError { + // Represents a level of severity. + enum Severity { + // Not specified. This value should never be used. + SEVERITY_UNSPECIFIED = 0; + + // The agent doesn't follow Dialogflow best practices. + INFO = 1; + + // The agent may not behave as expected. + WARNING = 2; + + // The agent may experience partial failures. + ERROR = 3; + + // The agent may completely fail. + CRITICAL = 4; + } + + // The severity of the error. + Severity severity = 1; + + // The names of the entries that the error is associated with. + // Format: + // + // - "projects//agent", if the error is associated with the entire + // agent. + // - "projects//agent/intents/", if the error is + // associated with certain intents. + // - "projects//agent/intents//trainingPhrases/", if the + // error is associated with certain intent training phrases. + // - "projects//agent/intents//parameters/", if the error is associated with certain intent parameters. + // - "projects//agent/entities/", if the error is + // associated with certain entities. + repeated string entries = 3; + + // The detailed error message. + string error_message = 4; +} + +// Represents the output of agent validation. +message ValidationResult { + // Contains all validation errors. + repeated ValidationError validation_errors = 1; +} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/version.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/version.proto new file mode 100644 index 00000000..e3752610 --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/version.proto @@ -0,0 +1,261 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "VersionProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Versions][google.cloud.dialogflow.v2beta1.Version]. +service Versions { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all versions of the specified agent. + rpc ListVersions(ListVersionsRequest) returns (ListVersionsResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/agent}/versions" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/agent}/versions" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified agent version. + rpc GetVersion(GetVersionRequest) returns (Version) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/agent/versions/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/agent/versions/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates an agent version. + // + // The new version points to the agent instance in the "default" environment. + rpc CreateVersion(CreateVersionRequest) returns (Version) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent}/versions" + body: "version" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent}/versions" + body: "version" + } + }; + option (google.api.method_signature) = "parent,version"; + } + + // Updates the specified agent version. + // + // Note that this method does not allow you to update the state of the agent + // the given version points to. It allows you to update only mutable + // properties of the version resource. + rpc UpdateVersion(UpdateVersionRequest) returns (Version) { + option (google.api.http) = { + patch: "/v2beta1/{version.name=projects/*/agent/versions/*}" + body: "version" + additional_bindings { + patch: "/v2beta1/{version.name=projects/*/locations/*/agent/versions/*}" + body: "version" + } + }; + option (google.api.method_signature) = "version,update_mask"; + } + + // Delete the specified agent version. + rpc DeleteVersion(DeleteVersionRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta1/{name=projects/*/agent/versions/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/agent/versions/*}" + } + }; + option (google.api.method_signature) = "name"; + } +} + +// You can create multiple versions of your agent and publish them to separate +// environments. +// +// When you edit an agent, you are editing the draft agent. At any point, you +// can save the draft agent as an agent version, which is an immutable snapshot +// of your agent. +// +// When you save the draft agent, it is published to the default environment. +// When you create agent versions, you can publish them to custom environments. +// You can create a variety of custom environments for: +// +// - testing +// - development +// - production +// - etc. +// +// For more information, see the [versions and environments +// guide](https://cloud.google.com/dialogflow/docs/agents-versions). +message Version { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Version" + pattern: "projects/{project}/agent/versions/{version}" + pattern: "projects/{project}/locations/{location}/agent/versions/{version}" + }; + + // The status of a version. + enum VersionStatus { + // Not specified. This value is not used. + VERSION_STATUS_UNSPECIFIED = 0; + + // Version is not ready to serve (e.g. training is in progress). + IN_PROGRESS = 1; + + // Version is ready to serve. + READY = 2; + + // Version training failed. + FAILED = 3; + } + + // Output only. The unique identifier of this agent version. + // Supported formats: + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The developer-provided description of this version. + string description = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The sequential number of this version. This field is read-only which means + // it cannot be set by create and update methods. + int32 version_number = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The creation time of this version. This field is read-only, i.e., it cannot + // be set by create and update methods. + google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The status of this version. This field is read-only and cannot be set by + // create and update methods. + VersionStatus status = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request message for [Versions.ListVersions][google.cloud.dialogflow.v2beta1.Versions.ListVersions]. +message ListVersionsRequest { + // Required. The agent to list all versions from. + // Supported formats: + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Version" + } + ]; + + // Optional. The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Versions.ListVersions][google.cloud.dialogflow.v2beta1.Versions.ListVersions]. +message ListVersionsResponse { + // The list of agent versions. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Version versions = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [Versions.GetVersion][google.cloud.dialogflow.v2beta1.Versions.GetVersion]. +message GetVersionRequest { + // Required. The name of the version. + // Supported formats: + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Version" + } + ]; +} + +// The request message for [Versions.CreateVersion][google.cloud.dialogflow.v2beta1.Versions.CreateVersion]. +message CreateVersionRequest { + // Required. The agent to create a version for. + // Supported formats: + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Version" + } + ]; + + // Required. The version to create. + Version version = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Versions.UpdateVersion][google.cloud.dialogflow.v2beta1.Versions.UpdateVersion]. +message UpdateVersionRequest { + // Required. The version to update. + // Supported formats: + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` + Version version = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Versions.DeleteVersion][google.cloud.dialogflow.v2beta1.Versions.DeleteVersion]. +message DeleteVersionRequest { + // Required. The name of the version to delete. + // Supported formats: + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Version" + } + ]; +} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/webhook.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/webhook.proto new file mode 100644 index 00000000..64c7efda --- /dev/null +++ b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/webhook.proto @@ -0,0 +1,165 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/cloud/dialogflow/v2beta1/context.proto"; +import "google/cloud/dialogflow/v2beta1/intent.proto"; +import "google/cloud/dialogflow/v2beta1/session.proto"; +import "google/cloud/dialogflow/v2beta1/session_entity_type.proto"; +import "google/protobuf/struct.proto"; +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "WebhookProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// The request message for a webhook call. +message WebhookRequest { + // The unique identifier of detectIntent request session. + // Can be used to identify end-user inside webhook implementation. + // Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + string session = 4; + + // The unique identifier of the response. Contains the same value as + // `[Streaming]DetectIntentResponse.response_id`. + string response_id = 1; + + // The result of the conversational query or event processing. Contains the + // same value as `[Streaming]DetectIntentResponse.query_result`. + QueryResult query_result = 2; + + // Alternative query results from KnowledgeService. + repeated QueryResult alternative_query_results = 5; + + // Optional. The contents of the original request that was passed to + // `[Streaming]DetectIntent` call. + OriginalDetectIntentRequest original_detect_intent_request = 3; +} + +// The response message for a webhook call. +// +// This response is validated by the Dialogflow server. If validation fails, +// an error will be returned in the [QueryResult.diagnostic_info][google.cloud.dialogflow.v2beta1.QueryResult.diagnostic_info] field. +// Setting JSON fields to an empty value with the wrong type is a common error. +// To avoid this error: +// +// - Use `""` for empty strings +// - Use `{}` or `null` for empty objects +// - Use `[]` or `null` for empty arrays +// +// For more information, see the +// [Protocol Buffers Language +// Guide](https://developers.google.com/protocol-buffers/docs/proto3#json). +message WebhookResponse { + // Optional. The text response message intended for the end-user. + // It is recommended to use `fulfillment_messages.text.text[0]` instead. + // When provided, Dialogflow uses this field to populate + // [QueryResult.fulfillment_text][google.cloud.dialogflow.v2beta1.QueryResult.fulfillment_text] sent to the integration or API caller. + string fulfillment_text = 1; + + // Optional. The rich response messages intended for the end-user. + // When provided, Dialogflow uses this field to populate + // [QueryResult.fulfillment_messages][google.cloud.dialogflow.v2beta1.QueryResult.fulfillment_messages] sent to the integration or API caller. + repeated Intent.Message fulfillment_messages = 2; + + // Optional. A custom field used to identify the webhook source. + // Arbitrary strings are supported. + // When provided, Dialogflow uses this field to populate + // [QueryResult.webhook_source][google.cloud.dialogflow.v2beta1.QueryResult.webhook_source] sent to the integration or API caller. + string source = 3; + + // Optional. This field can be used to pass custom data from your webhook to the + // integration or API caller. Arbitrary JSON objects are supported. + // When provided, Dialogflow uses this field to populate + // [QueryResult.webhook_payload][google.cloud.dialogflow.v2beta1.QueryResult.webhook_payload] sent to the integration or API caller. + // This field is also used by the + // [Google Assistant + // integration](https://cloud.google.com/dialogflow/docs/integrations/aog) + // for rich response messages. + // See the format definition at [Google Assistant Dialogflow webhook + // format](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json) + google.protobuf.Struct payload = 4; + + // Optional. The collection of output contexts that will overwrite currently + // active contexts for the session and reset their lifespans. + // When provided, Dialogflow uses this field to populate + // [QueryResult.output_contexts][google.cloud.dialogflow.v2beta1.QueryResult.output_contexts] sent to the integration or API caller. + repeated Context output_contexts = 5; + + // Optional. Invokes the supplied events. + // When this field is set, Dialogflow ignores the `fulfillment_text`, + // `fulfillment_messages`, and `payload` fields. + EventInput followup_event_input = 6; + + // Indicates that a live agent should be brought in to handle the + // interaction with the user. In most cases, when you set this flag to true, + // you would also want to set end_interaction to true as well. Default is + // false. + bool live_agent_handoff = 7; + + // Optional. Indicates that this intent ends an interaction. Some integrations + // (e.g., Actions on Google or Dialogflow phone gateway) use this information + // to close interaction with an end user. Default is false. + bool end_interaction = 8; + + // Optional. Additional session entity types to replace or extend developer + // entity types with. The entity synonyms apply to all languages and persist + // for the session. Setting this data from a webhook overwrites + // the session entity types that have been set using `detectIntent`, + // `streamingDetectIntent` or [SessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityType] management methods. + repeated SessionEntityType session_entity_types = 10; +} + +// Represents the contents of the original request that was passed to +// the `[Streaming]DetectIntent` call. +message OriginalDetectIntentRequest { + // The source of this request, e.g., `google`, `facebook`, `slack`. It is set + // by Dialogflow-owned servers. + string source = 1; + + // Optional. The version of the protocol used for this request. + // This field is AoG-specific. + string version = 2; + + // Optional. This field is set to the value of the `QueryParameters.payload` + // field passed in the request. Some integrations that query a Dialogflow + // agent may provide additional information in the payload. + // + // In particular, for the Dialogflow Phone Gateway integration, this field has + // the form: + //
{
+  //  "telephony": {
+  //    "caller_id": "+18558363987"
+  //  }
+  // }
+ // Note: The caller ID field (`caller_id`) will be redacted for Trial + // Edition agents and populated with the caller ID in [E.164 + // format](https://en.wikipedia.org/wiki/E.164) for Essentials Edition agents. + google.protobuf.Struct payload = 3; +} diff --git a/owl-bot-staging/v2beta1/src/index.ts b/owl-bot-staging/v2beta1/src/index.ts new file mode 100644 index 00000000..19b00df5 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/index.ts @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v2beta1 from './v2beta1'; +const AgentsClient = v2beta1.AgentsClient; +type AgentsClient = v2beta1.AgentsClient; +const AnswerRecordsClient = v2beta1.AnswerRecordsClient; +type AnswerRecordsClient = v2beta1.AnswerRecordsClient; +const ContextsClient = v2beta1.ContextsClient; +type ContextsClient = v2beta1.ContextsClient; +const ConversationProfilesClient = v2beta1.ConversationProfilesClient; +type ConversationProfilesClient = v2beta1.ConversationProfilesClient; +const ConversationsClient = v2beta1.ConversationsClient; +type ConversationsClient = v2beta1.ConversationsClient; +const DocumentsClient = v2beta1.DocumentsClient; +type DocumentsClient = v2beta1.DocumentsClient; +const EntityTypesClient = v2beta1.EntityTypesClient; +type EntityTypesClient = v2beta1.EntityTypesClient; +const EnvironmentsClient = v2beta1.EnvironmentsClient; +type EnvironmentsClient = v2beta1.EnvironmentsClient; +const FulfillmentsClient = v2beta1.FulfillmentsClient; +type FulfillmentsClient = v2beta1.FulfillmentsClient; +const IntentsClient = v2beta1.IntentsClient; +type IntentsClient = v2beta1.IntentsClient; +const KnowledgeBasesClient = v2beta1.KnowledgeBasesClient; +type KnowledgeBasesClient = v2beta1.KnowledgeBasesClient; +const ParticipantsClient = v2beta1.ParticipantsClient; +type ParticipantsClient = v2beta1.ParticipantsClient; +const SessionEntityTypesClient = v2beta1.SessionEntityTypesClient; +type SessionEntityTypesClient = v2beta1.SessionEntityTypesClient; +const SessionsClient = v2beta1.SessionsClient; +type SessionsClient = v2beta1.SessionsClient; +const VersionsClient = v2beta1.VersionsClient; +type VersionsClient = v2beta1.VersionsClient; +export {v2beta1, AgentsClient, AnswerRecordsClient, ContextsClient, ConversationProfilesClient, ConversationsClient, DocumentsClient, EntityTypesClient, EnvironmentsClient, FulfillmentsClient, IntentsClient, KnowledgeBasesClient, ParticipantsClient, SessionEntityTypesClient, SessionsClient, VersionsClient}; +export default {v2beta1, AgentsClient, AnswerRecordsClient, ContextsClient, ConversationProfilesClient, ConversationsClient, DocumentsClient, EntityTypesClient, EnvironmentsClient, FulfillmentsClient, IntentsClient, KnowledgeBasesClient, ParticipantsClient, SessionEntityTypesClient, SessionsClient, VersionsClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/agents_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/agents_client.ts new file mode 100644 index 00000000..a3c8a4b5 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/agents_client.ts @@ -0,0 +1,3088 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta1/agents_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './agents_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.Agent|Agents}. + * @class + * @memberof v2beta1 + */ +export class AgentsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + agentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AgentsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof AgentsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + searchAgents: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'agents') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + + this.operationsClient = this._gaxModule.lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }).operationsClient(opts); + const trainAgentResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const trainAgentMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + const exportAgentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.ExportAgentResponse') as gax.protobuf.Type; + const exportAgentMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + const importAgentResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const importAgentMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + const restoreAgentResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const restoreAgentMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + + this.descriptors.longrunning = { + trainAgent: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + trainAgentResponse.decode.bind(trainAgentResponse), + trainAgentMetadata.decode.bind(trainAgentMetadata)), + exportAgent: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + exportAgentResponse.decode.bind(exportAgentResponse), + exportAgentMetadata.decode.bind(exportAgentMetadata)), + importAgent: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importAgentResponse.decode.bind(importAgentResponse), + importAgentMetadata.decode.bind(importAgentMetadata)), + restoreAgent: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + restoreAgentResponse.decode.bind(restoreAgentResponse), + restoreAgentMetadata.decode.bind(restoreAgentMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.Agents', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.agentsStub) { + return this.agentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.Agents. + this.agentsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.Agents') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.Agents, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const agentsStubMethods = + ['getAgent', 'setAgent', 'deleteAgent', 'searchAgents', 'trainAgent', 'exportAgent', 'importAgent', 'restoreAgent', 'getValidationResult']; + for (const methodName of agentsStubMethods) { + const callPromise = this.agentsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.agentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getAgent( + request?: protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IAgent, + protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest|undefined, {}|undefined + ]>; + getAgent( + request: protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IAgent, + protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest|null|undefined, + {}|null|undefined>): void; + getAgent( + request: protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IAgent, + protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to fetch is associated with. + * Format: `projects/` or + * `projects//locations/`. + * @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. + * The first element of the array is an object representing [Agent]{@link google.cloud.dialogflow.v2beta1.Agent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getAgent(request); + */ + getAgent( + request?: protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IAgent, + protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IAgent, + protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IAgent, + protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.getAgent(request, options, callback); + } + setAgent( + request?: protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IAgent, + protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest|undefined, {}|undefined + ]>; + setAgent( + request: protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IAgent, + protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest|null|undefined, + {}|null|undefined>): void; + setAgent( + request: protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IAgent, + protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates/updates the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.Agent} request.agent + * Required. The agent to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Optional. The mask to control which fields get updated. + * @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. + * The first element of the array is an object representing [Agent]{@link google.cloud.dialogflow.v2beta1.Agent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.setAgent(request); + */ + setAgent( + request?: protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IAgent, + protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IAgent, + protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IAgent, + protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'agent.parent': request.agent!.parent || '', + }); + this.initialize(); + return this.innerApiCalls.setAgent(request, options, callback); + } + deleteAgent( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest|undefined, {}|undefined + ]>; + deleteAgent( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest|null|undefined, + {}|null|undefined>): void; + deleteAgent( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to delete is associated with. + * Format: `projects/` or + * `projects//locations/`. + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteAgent(request); + */ + deleteAgent( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.deleteAgent(request, options, callback); + } + getValidationResult( + request?: protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IValidationResult, + protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest|undefined, {}|undefined + ]>; + getValidationResult( + request: protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IValidationResult, + protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest|null|undefined, + {}|null|undefined>): void; + getValidationResult( + request: protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IValidationResult, + protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest|null|undefined, + {}|null|undefined>): void; +/** + * Gets agent validation result. Agent validation is performed during + * training time and is updated automatically when training is completed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent is associated with. + * Format: `projects/` or + * `projects//locations/`. + * @param {string} [request.languageCode] + * Optional. The language for which you want a validation result. If not + * specified, the agent's default language is used. [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. Note: languages must be enabled in the agent before they can + * be used. + * @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. + * The first element of the array is an object representing [ValidationResult]{@link google.cloud.dialogflow.v2beta1.ValidationResult}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getValidationResult(request); + */ + getValidationResult( + request?: protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IValidationResult, + protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IValidationResult, + protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IValidationResult, + protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.getValidationResult(request, options, callback); + } + + trainAgent( + request?: protos.google.cloud.dialogflow.v2beta1.ITrainAgentRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + trainAgent( + request: protos.google.cloud.dialogflow.v2beta1.ITrainAgentRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + trainAgent( + request: protos.google.cloud.dialogflow.v2beta1.ITrainAgentRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Trains the specified agent. + * + * + * Operation + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to train is associated with. + * Format: `projects/` or + * `projects//locations/`. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.trainAgent(request); + * const [response] = await operation.promise(); + */ + trainAgent( + request?: protos.google.cloud.dialogflow.v2beta1.ITrainAgentRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.trainAgent(request, options, callback); + } +/** + * Check the status of the long running operation returned by `trainAgent()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkTrainAgentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkTrainAgentProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.trainAgent, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + exportAgent( + request?: protos.google.cloud.dialogflow.v2beta1.IExportAgentRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + exportAgent( + request: protos.google.cloud.dialogflow.v2beta1.IExportAgentRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + exportAgent( + request: protos.google.cloud.dialogflow.v2beta1.IExportAgentRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Exports the specified agent to a ZIP file. + * + * + * Operation + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to export is associated with. + * Format: `projects/` or + * `projects//locations/`. + * @param {string} request.agentUri + * Optional. The + * [Google Cloud Storage](https://cloud.google.com/storage/docs/) + * URI to export the agent to. + * The format of this URI must be `gs:///`. + * If left unspecified, the serialized agent is returned inline. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.exportAgent(request); + * const [response] = await operation.promise(); + */ + exportAgent( + request?: protos.google.cloud.dialogflow.v2beta1.IExportAgentRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.exportAgent(request, options, callback); + } +/** + * Check the status of the long running operation returned by `exportAgent()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkExportAgentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkExportAgentProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.exportAgent, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + importAgent( + request?: protos.google.cloud.dialogflow.v2beta1.IImportAgentRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + importAgent( + request: protos.google.cloud.dialogflow.v2beta1.IImportAgentRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + importAgent( + request: protos.google.cloud.dialogflow.v2beta1.IImportAgentRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Imports the specified agent from a ZIP file. + * + * Uploads new intents and entity types without deleting the existing ones. + * Intents and entity types with the same name are replaced with the new + * versions from {@link google.cloud.dialogflow.v2beta1.ImportAgentRequest|ImportAgentRequest}. After the import, the imported draft + * agent will be trained automatically (unless disabled in agent settings). + * However, once the import is done, training may not be completed yet. Please + * call {@link google.cloud.dialogflow.v2beta1.Agents.TrainAgent|TrainAgent} and wait for the operation it returns in order to train + * explicitly. + * + * + * Operation + * An operation which tracks when importing is complete. It only tracks + * when the draft agent is updated not when it is done training. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to import is associated with. + * Format: `projects/` or + * `projects//locations/`. + * @param {string} request.agentUri + * The URI to a Google Cloud Storage file containing the agent to import. + * Note: The URI must start with "gs://". + * @param {Buffer} request.agentContent + * Zip compressed raw byte content for agent. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.importAgent(request); + * const [response] = await operation.promise(); + */ + importAgent( + request?: protos.google.cloud.dialogflow.v2beta1.IImportAgentRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.importAgent(request, options, callback); + } +/** + * Check the status of the long running operation returned by `importAgent()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkImportAgentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkImportAgentProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.importAgent, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + restoreAgent( + request?: protos.google.cloud.dialogflow.v2beta1.IRestoreAgentRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + restoreAgent( + request: protos.google.cloud.dialogflow.v2beta1.IRestoreAgentRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreAgent( + request: protos.google.cloud.dialogflow.v2beta1.IRestoreAgentRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Restores the specified agent from a ZIP file. + * + * Replaces the current agent version with a new one. All the intents and + * entity types in the older version are deleted. After the restore, the + * restored draft agent will be trained automatically (unless disabled in + * agent settings). However, once the restore is done, training may not be + * completed yet. Please call {@link google.cloud.dialogflow.v2beta1.Agents.TrainAgent|TrainAgent} and wait for the operation it + * returns in order to train explicitly. + * + * + * Operation + * An operation which tracks when restoring is complete. It only tracks + * when the draft agent is updated not when it is done training. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to restore is associated with. + * Format: `projects/` or + * `projects//locations/`. + * @param {string} request.agentUri + * The URI to a Google Cloud Storage file containing the agent to restore. + * Note: The URI must start with "gs://". + * @param {Buffer} request.agentContent + * Zip compressed raw byte content for agent. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.restoreAgent(request); + * const [response] = await operation.promise(); + */ + restoreAgent( + request?: protos.google.cloud.dialogflow.v2beta1.IRestoreAgentRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.restoreAgent(request, options, callback); + } +/** + * Check the status of the long running operation returned by `restoreAgent()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkRestoreAgentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkRestoreAgentProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.restoreAgent, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + searchAgents( + request?: protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IAgent[], + protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest|null, + protos.google.cloud.dialogflow.v2beta1.ISearchAgentsResponse + ]>; + searchAgents( + request: protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, + protos.google.cloud.dialogflow.v2beta1.ISearchAgentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IAgent>): void; + searchAgents( + request: protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, + protos.google.cloud.dialogflow.v2beta1.ISearchAgentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IAgent>): void; +/** + * Returns the list of agents. + * Since there is at most one conversational agent per project, this method is + * useful primarily for listing all agents across projects the caller has + * access to. One can achieve that with a wildcard project collection id "-". + * Refer to [List + * Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list agents from. + * Format: `projects/` or + * `projects//locations/`. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [Agent]{@link google.cloud.dialogflow.v2beta1.Agent}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `searchAgentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + searchAgents( + request?: protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, + protos.google.cloud.dialogflow.v2beta1.ISearchAgentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IAgent>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, + protos.google.cloud.dialogflow.v2beta1.ISearchAgentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IAgent>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IAgent[], + protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest|null, + protos.google.cloud.dialogflow.v2beta1.ISearchAgentsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.searchAgents(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list agents from. + * Format: `projects/` or + * `projects//locations/`. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Agent]{@link google.cloud.dialogflow.v2beta1.Agent} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `searchAgentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + searchAgentsStream( + request?: protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.searchAgents.createStream( + this.innerApiCalls.searchAgents as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `searchAgents`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list agents from. + * Format: `projects/` or + * `projects//locations/`. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Agent]{@link google.cloud.dialogflow.v2beta1.Agent}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.searchAgentsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + searchAgentsAsync( + request?: protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.searchAgents.asyncIterate( + this.innerApiCalls['searchAgents'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.agentsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/agents_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/agents_client_config.json new file mode 100644 index 00000000..b73a09e5 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/agents_client_config.json @@ -0,0 +1,74 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.Agents": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "GetAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SetAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SearchAgents": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "TrainAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ExportAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ImportAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "RestoreAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetValidationResult": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/agents_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/agents_proto_list.json new file mode 100644 index 00000000..cb5136f1 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/agents_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/answer_records_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/answer_records_client.ts new file mode 100644 index 00000000..7dec94ba --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/answer_records_client.ts @@ -0,0 +1,2463 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta1/answer_records_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './answer_records_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.AnswerRecord|AnswerRecords}. + * @class + * @memberof v2beta1 + */ +export class AnswerRecordsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + answerRecordsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AnswerRecordsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof AnswerRecordsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listAnswerRecords: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'answerRecords') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.AnswerRecords', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.answerRecordsStub) { + return this.answerRecordsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.AnswerRecords. + this.answerRecordsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.AnswerRecords') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.AnswerRecords, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const answerRecordsStubMethods = + ['getAnswerRecord', 'listAnswerRecords', 'updateAnswerRecord']; + for (const methodName of answerRecordsStubMethods) { + const callPromise = this.answerRecordsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.answerRecordsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getAnswerRecord( + request?: protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest|undefined, {}|undefined + ]>; + getAnswerRecord( + request: protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest|null|undefined, + {}|null|undefined>): void; + getAnswerRecord( + request: protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deprecated. + * Retrieves a specific answer record. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the answer record to retrieve. + * Format: `projects//locations//answerRecords/`. + * @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. + * The first element of the array is an object representing [AnswerRecord]{@link google.cloud.dialogflow.v2beta1.AnswerRecord}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getAnswerRecord(request); + * @deprecated GetAnswerRecord is deprecated and may be removed in a future version. + */ + getAnswerRecord( + request?: protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + this.warn('DEP$AnswerRecords-$GetAnswerRecord','GetAnswerRecord is deprecated and may be removed in a future version.', 'DeprecationWarning'); + return this.innerApiCalls.getAnswerRecord(request, options, callback); + } + updateAnswerRecord( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest|undefined, {}|undefined + ]>; + updateAnswerRecord( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest|null|undefined, + {}|null|undefined>): void; + updateAnswerRecord( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified answer record. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.AnswerRecord} request.answerRecord + * Required. Answer record to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields get updated. + * @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. + * The first element of the array is an object representing [AnswerRecord]{@link google.cloud.dialogflow.v2beta1.AnswerRecord}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateAnswerRecord(request); + */ + updateAnswerRecord( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'answer_record.name': request.answerRecord!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateAnswerRecord(request, options, callback); + } + + listAnswerRecords( + request?: protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord[], + protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse + ]>; + listAnswerRecords( + request: protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, + protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord>): void; + listAnswerRecords( + request: protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, + protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord>): void; +/** + * Returns the list of all answer records in the specified project in reverse + * chronological order. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list all answer records for in reverse + * chronological order. Format: `projects//locations/`. + * @param {number} request.pageSize + * Optional. The maximum number of records to return in a single page. + * The server may return fewer records than this. If unspecified, we use 10. + * The maximum is 100. + * @param {string} request.pageToken + * Optional. The + * {@link google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse.next_page_token|ListAnswerRecordsResponse.next_page_token} + * value returned from a previous list request used to continue listing on + * the next page. + * @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. + * The first element of the array is Array of [AnswerRecord]{@link google.cloud.dialogflow.v2beta1.AnswerRecord}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listAnswerRecordsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAnswerRecords( + request?: protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, + protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, + protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord[], + protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listAnswerRecords(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list all answer records for in reverse + * chronological order. Format: `projects//locations/`. + * @param {number} request.pageSize + * Optional. The maximum number of records to return in a single page. + * The server may return fewer records than this. If unspecified, we use 10. + * The maximum is 100. + * @param {string} request.pageToken + * Optional. The + * {@link google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse.next_page_token|ListAnswerRecordsResponse.next_page_token} + * value returned from a previous list request used to continue listing on + * the next page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [AnswerRecord]{@link google.cloud.dialogflow.v2beta1.AnswerRecord} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listAnswerRecordsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAnswerRecordsStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listAnswerRecords.createStream( + this.innerApiCalls.listAnswerRecords as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAnswerRecords`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list all answer records for in reverse + * chronological order. Format: `projects//locations/`. + * @param {number} request.pageSize + * Optional. The maximum number of records to return in a single page. + * The server may return fewer records than this. If unspecified, we use 10. + * The maximum is 100. + * @param {string} request.pageToken + * Optional. The + * {@link google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse.next_page_token|ListAnswerRecordsResponse.next_page_token} + * value returned from a previous list request used to continue listing on + * the next page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [AnswerRecord]{@link google.cloud.dialogflow.v2beta1.AnswerRecord}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listAnswerRecordsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listAnswerRecordsAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listAnswerRecords.asyncIterate( + this.innerApiCalls['listAnswerRecords'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.answerRecordsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/answer_records_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/answer_records_client_config.json new file mode 100644 index 00000000..34e2ae76 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/answer_records_client_config.json @@ -0,0 +1,44 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.AnswerRecords": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "GetAnswerRecord": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListAnswerRecords": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateAnswerRecord": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/answer_records_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/answer_records_proto_list.json new file mode 100644 index 00000000..cb5136f1 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/answer_records_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/contexts_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/contexts_client.ts new file mode 100644 index 00000000..48699b0b --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/contexts_client.ts @@ -0,0 +1,2781 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta1/contexts_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './contexts_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.Context|Contexts}. + * @class + * @memberof v2beta1 + */ +export class ContextsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + contextsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ContextsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ContextsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listContexts: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'contexts') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.Contexts', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.contextsStub) { + return this.contextsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.Contexts. + this.contextsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.Contexts') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.Contexts, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const contextsStubMethods = + ['listContexts', 'getContext', 'createContext', 'updateContext', 'deleteContext', 'deleteAllContexts']; + for (const methodName of contextsStubMethods) { + const callPromise = this.contextsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.contextsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getContext( + request?: protos.google.cloud.dialogflow.v2beta1.IGetContextRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.IGetContextRequest|undefined, {}|undefined + ]>; + getContext( + request: protos.google.cloud.dialogflow.v2beta1.IGetContextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.IGetContextRequest|null|undefined, + {}|null|undefined>): void; + getContext( + request: protos.google.cloud.dialogflow.v2beta1.IGetContextRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.IGetContextRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified context. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the context. Supported formats: + * - `projects//agent/sessions//contexts/`, + * - `projects//locations//agent/sessions//contexts/`, + * - `projects//agent/environments//users//sessions//contexts/`, + * - `projects//locations//agent/environments//users//sessions//contexts/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @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. + * The first element of the array is an object representing [Context]{@link google.cloud.dialogflow.v2beta1.Context}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getContext(request); + */ + getContext( + request?: protos.google.cloud.dialogflow.v2beta1.IGetContextRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.IGetContextRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.IGetContextRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.IGetContextRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getContext(request, options, callback); + } + createContext( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest|undefined, {}|undefined + ]>; + createContext( + request: protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest|null|undefined, + {}|null|undefined>): void; + createContext( + request: protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a context. + * + * If the specified context already exists, overrides the context. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to create a context for. Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @param {google.cloud.dialogflow.v2beta1.Context} request.context + * Required. The context to create. + * @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. + * The first element of the array is an object representing [Context]{@link google.cloud.dialogflow.v2beta1.Context}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createContext(request); + */ + createContext( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createContext(request, options, callback); + } + updateContext( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest|undefined, {}|undefined + ]>; + updateContext( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest|null|undefined, + {}|null|undefined>): void; + updateContext( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified context. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.Context} request.context + * Required. The context to update. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @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. + * The first element of the array is an object representing [Context]{@link google.cloud.dialogflow.v2beta1.Context}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateContext(request); + */ + updateContext( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'context.name': request.context!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateContext(request, options, callback); + } + deleteContext( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest|undefined, {}|undefined + ]>; + deleteContext( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest|null|undefined, + {}|null|undefined>): void; + deleteContext( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified context. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the context to delete. Supported formats: + * - `projects//agent/sessions//contexts/`, + * - `projects//locations//agent/sessions//contexts/`, + * - `projects//agent/environments//users//sessions//contexts/`, + * - `projects//locations//agent/environments//users//sessions//contexts/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteContext(request); + */ + deleteContext( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteContext(request, options, callback); + } + deleteAllContexts( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest|undefined, {}|undefined + ]>; + deleteAllContexts( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest|null|undefined, + {}|null|undefined>): void; + deleteAllContexts( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes all active contexts in the specified session. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the session to delete all contexts from. Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified we assume default 'draft' environment. If + * `User ID` is not specified, we assume default '-' user. + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteAllContexts(request); + */ + deleteAllContexts( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.deleteAllContexts(request, options, callback); + } + + listContexts( + request?: protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IContext[], + protos.google.cloud.dialogflow.v2beta1.IListContextsRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListContextsResponse + ]>; + listContexts( + request: protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, + protos.google.cloud.dialogflow.v2beta1.IListContextsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IContext>): void; + listContexts( + request: protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, + protos.google.cloud.dialogflow.v2beta1.IListContextsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IContext>): void; +/** + * Returns the list of all contexts in the specified session. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to list all contexts from. Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [Context]{@link google.cloud.dialogflow.v2beta1.Context}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listContextsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listContexts( + request?: protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, + protos.google.cloud.dialogflow.v2beta1.IListContextsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IContext>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, + protos.google.cloud.dialogflow.v2beta1.IListContextsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IContext>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IContext[], + protos.google.cloud.dialogflow.v2beta1.IListContextsRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListContextsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listContexts(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to list all contexts from. Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Context]{@link google.cloud.dialogflow.v2beta1.Context} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listContextsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listContextsStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listContexts.createStream( + this.innerApiCalls.listContexts as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listContexts`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to list all contexts from. Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Context]{@link google.cloud.dialogflow.v2beta1.Context}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listContextsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listContextsAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listContexts.asyncIterate( + this.innerApiCalls['listContexts'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSession resource name string. + * + * @param {string} project + * @param {string} session + * @returns {string} Resource name string. + */ + projectAgentSessionPath(project:string,session:string) { + return this.pathTemplates.projectAgentSessionPathTemplate.render({ + project: project, + session: session, + }); + } + + /** + * Parse the project from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).project; + } + + /** + * Parse the session from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).session; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.contextsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/contexts_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/contexts_client_config.json new file mode 100644 index 00000000..d9e5c1a5 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/contexts_client_config.json @@ -0,0 +1,59 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.Contexts": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListContexts": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetContext": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateContext": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateContext": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteContext": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteAllContexts": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/contexts_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/contexts_proto_list.json new file mode 100644 index 00000000..cb5136f1 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/contexts_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_client.ts new file mode 100644 index 00000000..0487c2db --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_client.ts @@ -0,0 +1,2599 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta1/conversation_profiles_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './conversation_profiles_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.ConversationProfile|ConversationProfiles}. + * @class + * @memberof v2beta1 + */ +export class ConversationProfilesClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + conversationProfilesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ConversationProfilesClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ConversationProfilesClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listConversationProfiles: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'conversationProfiles') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.ConversationProfiles', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.conversationProfilesStub) { + return this.conversationProfilesStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.ConversationProfiles. + this.conversationProfilesStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.ConversationProfiles') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.ConversationProfiles, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const conversationProfilesStubMethods = + ['listConversationProfiles', 'getConversationProfile', 'createConversationProfile', 'updateConversationProfile', 'deleteConversationProfile']; + for (const methodName of conversationProfilesStubMethods) { + const callPromise = this.conversationProfilesStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.conversationProfilesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getConversationProfile( + request?: protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest|undefined, {}|undefined + ]>; + getConversationProfile( + request: protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest|null|undefined, + {}|null|undefined>): void; + getConversationProfile( + request: protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified conversation profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the conversation profile. + * Format: `projects//locations//conversationProfiles/`. + * @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. + * The first element of the array is an object representing [ConversationProfile]{@link google.cloud.dialogflow.v2beta1.ConversationProfile}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getConversationProfile(request); + */ + getConversationProfile( + request?: protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getConversationProfile(request, options, callback); + } + createConversationProfile( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest|undefined, {}|undefined + ]>; + createConversationProfile( + request: protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest|null|undefined, + {}|null|undefined>): void; + createConversationProfile( + request: protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a conversation profile in the specified project. + * + * {@link |ConversationProfile.CreateTime} and {@link |ConversationProfile.UpdateTime} + * aren't populated in the response. You can retrieve them via + * {@link google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile|GetConversationProfile} API. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to create a conversation profile for. + * Format: `projects//locations/`. + * @param {google.cloud.dialogflow.v2beta1.ConversationProfile} request.conversationProfile + * Required. The conversation profile to create. + * @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. + * The first element of the array is an object representing [ConversationProfile]{@link google.cloud.dialogflow.v2beta1.ConversationProfile}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createConversationProfile(request); + */ + createConversationProfile( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createConversationProfile(request, options, callback); + } + updateConversationProfile( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest|undefined, {}|undefined + ]>; + updateConversationProfile( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest|null|undefined, + {}|null|undefined>): void; + updateConversationProfile( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified conversation profile. + * + * {@link |ConversationProfile.CreateTime} and {@link |ConversationProfile.UpdateTime} + * aren't populated in the response. You can retrieve them via + * {@link google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile|GetConversationProfile} API. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.ConversationProfile} request.conversationProfile + * Required. The conversation profile to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields to update. + * @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. + * The first element of the array is an object representing [ConversationProfile]{@link google.cloud.dialogflow.v2beta1.ConversationProfile}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateConversationProfile(request); + */ + updateConversationProfile( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'conversation_profile.name': request.conversationProfile!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateConversationProfile(request, options, callback); + } + deleteConversationProfile( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest|undefined, {}|undefined + ]>; + deleteConversationProfile( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest|null|undefined, + {}|null|undefined>): void; + deleteConversationProfile( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified conversation profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the conversation profile to delete. + * Format: `projects//locations//conversationProfiles/`. + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteConversationProfile(request); + */ + deleteConversationProfile( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteConversationProfile(request, options, callback); + } + + listConversationProfiles( + request?: protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IConversationProfile[], + protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse + ]>; + listConversationProfiles( + request: protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, + protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IConversationProfile>): void; + listConversationProfiles( + request: protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, + protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IConversationProfile>): void; +/** + * Returns the list of all conversation profiles in the specified project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list all conversation profiles from. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [ConversationProfile]{@link google.cloud.dialogflow.v2beta1.ConversationProfile}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listConversationProfilesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listConversationProfiles( + request?: protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, + protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IConversationProfile>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, + protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IConversationProfile>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IConversationProfile[], + protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listConversationProfiles(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list all conversation profiles from. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ConversationProfile]{@link google.cloud.dialogflow.v2beta1.ConversationProfile} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listConversationProfilesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listConversationProfilesStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listConversationProfiles.createStream( + this.innerApiCalls.listConversationProfiles as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listConversationProfiles`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list all conversation profiles from. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [ConversationProfile]{@link google.cloud.dialogflow.v2beta1.ConversationProfile}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listConversationProfilesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listConversationProfilesAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listConversationProfiles.asyncIterate( + this.innerApiCalls['listConversationProfiles'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.conversationProfilesStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_client_config.json new file mode 100644 index 00000000..1a172fb9 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.ConversationProfiles": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListConversationProfiles": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetConversationProfile": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateConversationProfile": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateConversationProfile": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteConversationProfile": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_proto_list.json new file mode 100644 index 00000000..cb5136f1 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/conversations_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/conversations_client.ts new file mode 100644 index 00000000..36df034b --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/conversations_client.ts @@ -0,0 +1,2896 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta1/conversations_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './conversations_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.Conversation|Conversations}. + * @class + * @memberof v2beta1 + */ +export class ConversationsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + conversationsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ConversationsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ConversationsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listConversations: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'conversations'), + listMessages: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'messages') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.Conversations', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.conversationsStub) { + return this.conversationsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.Conversations. + this.conversationsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.Conversations') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.Conversations, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const conversationsStubMethods = + ['createConversation', 'listConversations', 'getConversation', 'completeConversation', 'batchCreateMessages', 'listMessages']; + for (const methodName of conversationsStubMethods) { + const callPromise = this.conversationsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.conversationsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createConversation( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IConversation, + protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest|undefined, {}|undefined + ]>; + createConversation( + request: protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest|null|undefined, + {}|null|undefined>): void; + createConversation( + request: protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a new conversation. Conversations are auto-completed after 24 + * hours. + * + * Conversation Lifecycle: + * There are two stages during a conversation: Automated Agent Stage and + * Assist Stage. + * + * For Automated Agent Stage, there will be a dialogflow agent responding to + * user queries. + * + * For Assist Stage, there's no dialogflow agent responding to user queries. + * But we will provide suggestions which are generated from conversation. + * + * If {@link google.cloud.dialogflow.v2beta1.Conversation.conversation_profile|Conversation.conversation_profile} is configured for a dialogflow + * agent, conversation will start from `Automated Agent Stage`, otherwise, it + * will start from `Assist Stage`. And during `Automated Agent Stage`, once an + * {@link google.cloud.dialogflow.v2beta1.Intent|Intent} with {@link google.cloud.dialogflow.v2beta1.Intent.live_agent_handoff|Intent.live_agent_handoff} is triggered, conversation + * will transfer to Assist Stage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource identifier of the project creating the conversation. + * Format: `projects//locations/`. + * @param {google.cloud.dialogflow.v2beta1.Conversation} request.conversation + * Required. The conversation to create. + * @param {string} [request.conversationId] + * Optional. Identifier of the conversation. Generally it's auto generated by Google. + * Only set it if you cannot wait for the response to return a + * auto-generated one to you. + * + * The conversation ID must be compliant with the regression fomula + * "{@link a-zA-Z0-9_-|a-zA-Z}*" with the characters length in range of [3,64]. + * If the field is provided, the caller is resposible for + * 1. the uniqueness of the ID, otherwise the request will be rejected. + * 2. the consistency for whether to use custom ID or not under a project to + * better ensure uniqueness. + * @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. + * The first element of the array is an object representing [Conversation]{@link google.cloud.dialogflow.v2beta1.Conversation}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createConversation(request); + */ + createConversation( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IConversation, + protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createConversation(request, options, callback); + } + getConversation( + request?: protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IConversation, + protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest|undefined, {}|undefined + ]>; + getConversation( + request: protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest|null|undefined, + {}|null|undefined>): void; + getConversation( + request: protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specific conversation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the conversation. Format: + * `projects//locations//conversations/`. + * @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. + * The first element of the array is an object representing [Conversation]{@link google.cloud.dialogflow.v2beta1.Conversation}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getConversation(request); + */ + getConversation( + request?: protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IConversation, + protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getConversation(request, options, callback); + } + completeConversation( + request?: protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IConversation, + protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest|undefined, {}|undefined + ]>; + completeConversation( + request: protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest|null|undefined, + {}|null|undefined>): void; + completeConversation( + request: protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest|null|undefined, + {}|null|undefined>): void; +/** + * Completes the specified conversation. Finished conversations are purged + * from the database after 30 days. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource identifier of the conversation to close. + * Format: `projects//locations//conversations/`. + * @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. + * The first element of the array is an object representing [Conversation]{@link google.cloud.dialogflow.v2beta1.Conversation}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.completeConversation(request); + */ + completeConversation( + request?: protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IConversation, + protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.completeConversation(request, options, callback); + } + batchCreateMessages( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse, + protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest|undefined, {}|undefined + ]>; + batchCreateMessages( + request: protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse, + protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest|null|undefined, + {}|null|undefined>): void; + batchCreateMessages( + request: protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse, + protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest|null|undefined, + {}|null|undefined>): void; +/** + * Batch ingests messages to conversation. Customers can use this RPC to + * ingest historical messages to conversation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource identifier of the conversation to create message. + * Format: `projects//locations//conversations/`. + * @param {number[]} request.requests + * Required. A maximum of 1000 Messages can be created in a batch. + * {@link |CreateMessageRequest.message.send_time} is required. All created + * messages will have identical {@link google.cloud.dialogflow.v2beta1.Message.create_time|Message.create_time}. + * @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. + * The first element of the array is an object representing [BatchCreateMessagesResponse]{@link google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.batchCreateMessages(request); + */ + batchCreateMessages( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse, + protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse, + protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse, + protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchCreateMessages(request, options, callback); + } + + listConversations( + request?: protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IConversation[], + protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListConversationsResponse + ]>; + listConversations( + request: protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, + protos.google.cloud.dialogflow.v2beta1.IListConversationsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IConversation>): void; + listConversations( + request: protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, + protos.google.cloud.dialogflow.v2beta1.IListConversationsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IConversation>): void; +/** + * Returns the list of all conversations in the specified project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project from which to list all conversation. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {string} request.filter + * A filter expression that filters conversations listed in the response. In + * general, the expression must specify the field name, a comparison operator, + * and the value to use for filtering: + *
    + *
  • The value must be a string, a number, or a boolean.
  • + *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + *
  • To filter on multiple expressions, separate the + * expressions with `AND` or `OR` (omitting both implies `AND`).
  • + *
  • For clarity, expressions can be enclosed in parentheses.
  • + *
+ * Only `lifecycle_state` can be filtered on in this way. For example, + * the following expression only returns `COMPLETED` conversations: + * + * `lifecycle_state = "COMPLETED"` + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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. + * The first element of the array is Array of [Conversation]{@link google.cloud.dialogflow.v2beta1.Conversation}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listConversationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listConversations( + request?: protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, + protos.google.cloud.dialogflow.v2beta1.IListConversationsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IConversation>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, + protos.google.cloud.dialogflow.v2beta1.IListConversationsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IConversation>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IConversation[], + protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListConversationsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listConversations(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project from which to list all conversation. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {string} request.filter + * A filter expression that filters conversations listed in the response. In + * general, the expression must specify the field name, a comparison operator, + * and the value to use for filtering: + *
    + *
  • The value must be a string, a number, or a boolean.
  • + *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + *
  • To filter on multiple expressions, separate the + * expressions with `AND` or `OR` (omitting both implies `AND`).
  • + *
  • For clarity, expressions can be enclosed in parentheses.
  • + *
+ * Only `lifecycle_state` can be filtered on in this way. For example, + * the following expression only returns `COMPLETED` conversations: + * + * `lifecycle_state = "COMPLETED"` + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Conversation]{@link google.cloud.dialogflow.v2beta1.Conversation} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listConversationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listConversationsStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listConversations.createStream( + this.innerApiCalls.listConversations as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listConversations`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project from which to list all conversation. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {string} request.filter + * A filter expression that filters conversations listed in the response. In + * general, the expression must specify the field name, a comparison operator, + * and the value to use for filtering: + *
    + *
  • The value must be a string, a number, or a boolean.
  • + *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + *
  • To filter on multiple expressions, separate the + * expressions with `AND` or `OR` (omitting both implies `AND`).
  • + *
  • For clarity, expressions can be enclosed in parentheses.
  • + *
+ * Only `lifecycle_state` can be filtered on in this way. For example, + * the following expression only returns `COMPLETED` conversations: + * + * `lifecycle_state = "COMPLETED"` + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Conversation]{@link google.cloud.dialogflow.v2beta1.Conversation}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listConversationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listConversationsAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listConversations.asyncIterate( + this.innerApiCalls['listConversations'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + listMessages( + request?: protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IMessage[], + protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListMessagesResponse + ]>; + listMessages( + request: protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, + protos.google.cloud.dialogflow.v2beta1.IListMessagesResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IMessage>): void; + listMessages( + request: protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, + protos.google.cloud.dialogflow.v2beta1.IListMessagesResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IMessage>): void; +/** + * Lists messages that belong to a given conversation. + * `messages` are ordered by `create_time` in descending order. To fetch + * updates without duplication, send request with filter + * `create_time_epoch_microseconds > + * [first item's create_time of previous request]` and empty page_token. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the conversation to list messages for. + * Format: `projects//locations//conversations/` + * @param {string} request.filter + * Optional. Filter on message fields. Currently predicates on `create_time` + * and `create_time_epoch_microseconds` are supported. `create_time` only + * support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > "2017-01-15T01:30:15.01Z"`. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [Message]{@link google.cloud.dialogflow.v2beta1.Message}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listMessagesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listMessages( + request?: protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, + protos.google.cloud.dialogflow.v2beta1.IListMessagesResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IMessage>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, + protos.google.cloud.dialogflow.v2beta1.IListMessagesResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IMessage>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IMessage[], + protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListMessagesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listMessages(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the conversation to list messages for. + * Format: `projects//locations//conversations/` + * @param {string} request.filter + * Optional. Filter on message fields. Currently predicates on `create_time` + * and `create_time_epoch_microseconds` are supported. `create_time` only + * support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > "2017-01-15T01:30:15.01Z"`. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Message]{@link google.cloud.dialogflow.v2beta1.Message} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listMessagesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listMessagesStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listMessages.createStream( + this.innerApiCalls.listMessages as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listMessages`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the conversation to list messages for. + * Format: `projects//locations//conversations/` + * @param {string} request.filter + * Optional. Filter on message fields. Currently predicates on `create_time` + * and `create_time_epoch_microseconds` are supported. `create_time` only + * support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > "2017-01-15T01:30:15.01Z"`. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Message]{@link google.cloud.dialogflow.v2beta1.Message}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listMessagesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listMessagesAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listMessages.asyncIterate( + this.innerApiCalls['listMessages'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.conversationsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/conversations_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/conversations_client_config.json new file mode 100644 index 00000000..2e1a335b --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/conversations_client_config.json @@ -0,0 +1,59 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.Conversations": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateConversation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListConversations": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetConversation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CompleteConversation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchCreateMessages": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListMessages": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/conversations_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/conversations_proto_list.json new file mode 100644 index 00000000..cb5136f1 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/conversations_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/documents_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/documents_client.ts new file mode 100644 index 00000000..370e0d94 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/documents_client.ts @@ -0,0 +1,3032 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta1/documents_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './documents_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for managing knowledge {@link google.cloud.dialogflow.v2beta1.Document|Documents}. + * @class + * @memberof v2beta1 + */ +export class DocumentsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + documentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DocumentsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof DocumentsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listDocuments: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'documents') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + + this.operationsClient = this._gaxModule.lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }).operationsClient(opts); + const createDocumentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.Document') as gax.protobuf.Type; + const createDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata') as gax.protobuf.Type; + const importDocumentsResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.ImportDocumentsResponse') as gax.protobuf.Type; + const importDocumentsMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata') as gax.protobuf.Type; + const deleteDocumentResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata') as gax.protobuf.Type; + const updateDocumentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.Document') as gax.protobuf.Type; + const updateDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata') as gax.protobuf.Type; + const reloadDocumentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.Document') as gax.protobuf.Type; + const reloadDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createDocumentResponse.decode.bind(createDocumentResponse), + createDocumentMetadata.decode.bind(createDocumentMetadata)), + importDocuments: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importDocumentsResponse.decode.bind(importDocumentsResponse), + importDocumentsMetadata.decode.bind(importDocumentsMetadata)), + deleteDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteDocumentResponse.decode.bind(deleteDocumentResponse), + deleteDocumentMetadata.decode.bind(deleteDocumentMetadata)), + updateDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateDocumentResponse.decode.bind(updateDocumentResponse), + updateDocumentMetadata.decode.bind(updateDocumentMetadata)), + reloadDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + reloadDocumentResponse.decode.bind(reloadDocumentResponse), + reloadDocumentMetadata.decode.bind(reloadDocumentMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.Documents', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.documentsStub) { + return this.documentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.Documents. + this.documentsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.Documents') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.Documents, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const documentsStubMethods = + ['listDocuments', 'getDocument', 'createDocument', 'importDocuments', 'deleteDocument', 'updateDocument', 'reloadDocument']; + for (const methodName of documentsStubMethods) { + const callPromise = this.documentsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.documentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getDocument( + request?: protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest|undefined, {}|undefined + ]>; + getDocument( + request: protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest|null|undefined, + {}|null|undefined>): void; + getDocument( + request: protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified document. + * + * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + * only use `projects.knowledgeBases.documents`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the document to retrieve. + * 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. + * The first element of the array is an object representing [Document]{@link google.cloud.dialogflow.v2beta1.Document}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getDocument(request); + */ + getDocument( + request?: protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getDocument(request, options, callback); + } + + createDocument( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateDocumentRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createDocument( + request: protos.google.cloud.dialogflow.v2beta1.ICreateDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createDocument( + request: protos.google.cloud.dialogflow.v2beta1.ICreateDocumentRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Creates a new document. + * + * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + * only use `projects.knowledgeBases.documents`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The knowledge base to create a document for. + * 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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.createDocument(request); + * const [response] = await operation.promise(); + */ + createDocument( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateDocumentRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createDocument(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createDocument()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkCreateDocumentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkCreateDocumentProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createDocument, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + importDocuments( + request?: protos.google.cloud.dialogflow.v2beta1.IImportDocumentsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + importDocuments( + request: protos.google.cloud.dialogflow.v2beta1.IImportDocumentsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + importDocuments( + request: protos.google.cloud.dialogflow.v2beta1.IImportDocumentsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Create documents by importing data from external sources. + * Dialogflow supports up to 350 documents in each request. If you try to + * import more, Dialogflow will return an error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The knowledge base to import documents into. + * Format: `projects//locations//knowledgeBases/`. + * @param {google.cloud.dialogflow.v2beta1.GcsSources} request.gcsSource + * The Google Cloud Storage location for the documents. + * The path can include a wildcard. + * + * These URIs may have the forms + * `gs:///`. + * `gs:////*.`. + * @param {google.cloud.dialogflow.v2beta1.ImportDocumentTemplate} request.documentTemplate + * Required. Document template used for importing all the documents. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.importDocuments(request); + * const [response] = await operation.promise(); + */ + importDocuments( + request?: protos.google.cloud.dialogflow.v2beta1.IImportDocumentsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.importDocuments(request, options, callback); + } +/** + * Check the status of the long running operation returned by `importDocuments()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkImportDocumentsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkImportDocumentsProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.importDocuments, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + deleteDocument( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteDocument( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteDocument( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified document. + * + * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + * only use `projects.knowledgeBases.documents`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the document to delete. + * 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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.deleteDocument(request); + * const [response] = await operation.promise(); + */ + deleteDocument( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteDocument(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteDocument()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkDeleteDocumentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkDeleteDocumentProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteDocument, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + updateDocument( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateDocument( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateDocument( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified document. + * + * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + * only use `projects.knowledgeBases.documents`. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.Document} request.document + * Required. The document to update. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Not specified means `update all`. + * Currently, only `display_name` can be updated, an InvalidArgument will be + * returned for attempting to update other fields. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.updateDocument(request); + * const [response] = await operation.promise(); + */ + updateDocument( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'document.name': request.document!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateDocument(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateDocument()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkUpdateDocumentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkUpdateDocumentProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateDocument, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + reloadDocument( + request?: protos.google.cloud.dialogflow.v2beta1.IReloadDocumentRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + reloadDocument( + request: protos.google.cloud.dialogflow.v2beta1.IReloadDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + reloadDocument( + request: protos.google.cloud.dialogflow.v2beta1.IReloadDocumentRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Reloads the specified document from its specified source, content_uri or + * content. The previously loaded content of the document will be deleted. + * Note: Even when the content of the document has not changed, there still + * may be side effects because of internal implementation changes. + * Note: If the document source is Google Cloud Storage URI, its metadata will + * be replaced with the custom metadata from Google Cloud Storage if the + * `import_gcs_custom_metadata` field is set to true in the request. + * + * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + * only use `projects.knowledgeBases.documents`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the document to reload. + * 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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.reloadDocument(request); + * const [response] = await operation.promise(); + */ + reloadDocument( + request?: protos.google.cloud.dialogflow.v2beta1.IReloadDocumentRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.reloadDocument(request, options, callback); + } +/** + * Check the status of the long running operation returned by `reloadDocument()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkReloadDocumentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkReloadDocumentProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.reloadDocument, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + listDocuments( + request?: protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IDocument[], + protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListDocumentsResponse + ]>; + listDocuments( + request: protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, + protos.google.cloud.dialogflow.v2beta1.IListDocumentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IDocument>): void; + listDocuments( + request: protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, + protos.google.cloud.dialogflow.v2beta1.IListDocumentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IDocument>): void; +/** + * Returns the list of all documents of the knowledge base. + * + * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + * only use `projects.knowledgeBases.documents`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The knowledge base to list all documents for. + * 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. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter documents returned by the list method. + * The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * + * Examples: + * + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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. + * The first element of the array is Array of [Document]{@link google.cloud.dialogflow.v2beta1.Document}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listDocumentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listDocuments( + request?: protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, + protos.google.cloud.dialogflow.v2beta1.IListDocumentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IDocument>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, + protos.google.cloud.dialogflow.v2beta1.IListDocumentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IDocument>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IDocument[], + protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListDocumentsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listDocuments(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The knowledge base to list all documents for. + * 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. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter documents returned by the list method. + * The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * + * Examples: + * + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Document]{@link google.cloud.dialogflow.v2beta1.Document} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listDocumentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listDocumentsStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listDocuments.createStream( + this.innerApiCalls.listDocuments as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listDocuments`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The knowledge base to list all documents for. + * 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. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter documents returned by the list method. + * The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * + * Examples: + * + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Document]{@link google.cloud.dialogflow.v2beta1.Document}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listDocumentsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listDocumentsAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listDocuments.asyncIterate( + this.innerApiCalls['listDocuments'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.documentsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/documents_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/documents_client_config.json new file mode 100644 index 00000000..99466943 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/documents_client_config.json @@ -0,0 +1,64 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.Documents": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListDocuments": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ImportDocuments": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ReloadDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/documents_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/documents_proto_list.json new file mode 100644 index 00000000..cb5136f1 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/documents_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/entity_types_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/entity_types_client.ts new file mode 100644 index 00000000..6a070e2f --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/entity_types_client.ts @@ -0,0 +1,3244 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta1/entity_types_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './entity_types_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.EntityType|EntityTypes}. + * @class + * @memberof v2beta1 + */ +export class EntityTypesClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + entityTypesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of EntityTypesClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof EntityTypesClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listEntityTypes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'entityTypes') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + + this.operationsClient = this._gaxModule.lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }).operationsClient(opts); + const batchUpdateEntityTypesResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse') as gax.protobuf.Type; + const batchUpdateEntityTypesMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + const batchDeleteEntityTypesResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const batchDeleteEntityTypesMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + const batchCreateEntitiesResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const batchCreateEntitiesMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + const batchUpdateEntitiesResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const batchUpdateEntitiesMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + const batchDeleteEntitiesResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const batchDeleteEntitiesMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + + this.descriptors.longrunning = { + batchUpdateEntityTypes: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchUpdateEntityTypesResponse.decode.bind(batchUpdateEntityTypesResponse), + batchUpdateEntityTypesMetadata.decode.bind(batchUpdateEntityTypesMetadata)), + batchDeleteEntityTypes: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchDeleteEntityTypesResponse.decode.bind(batchDeleteEntityTypesResponse), + batchDeleteEntityTypesMetadata.decode.bind(batchDeleteEntityTypesMetadata)), + batchCreateEntities: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchCreateEntitiesResponse.decode.bind(batchCreateEntitiesResponse), + batchCreateEntitiesMetadata.decode.bind(batchCreateEntitiesMetadata)), + batchUpdateEntities: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchUpdateEntitiesResponse.decode.bind(batchUpdateEntitiesResponse), + batchUpdateEntitiesMetadata.decode.bind(batchUpdateEntitiesMetadata)), + batchDeleteEntities: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchDeleteEntitiesResponse.decode.bind(batchDeleteEntitiesResponse), + batchDeleteEntitiesMetadata.decode.bind(batchDeleteEntitiesMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.EntityTypes', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.entityTypesStub) { + return this.entityTypesStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.EntityTypes. + this.entityTypesStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.EntityTypes') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.EntityTypes, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const entityTypesStubMethods = + ['listEntityTypes', 'getEntityType', 'createEntityType', 'updateEntityType', 'deleteEntityType', 'batchUpdateEntityTypes', 'batchDeleteEntityTypes', 'batchCreateEntities', 'batchUpdateEntities', 'batchDeleteEntities']; + for (const methodName of entityTypesStubMethods) { + const callPromise = this.entityTypesStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.entityTypesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IEntityType, + protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest|undefined, {}|undefined + ]>; + getEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest|null|undefined, + {}|null|undefined>): void; + getEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified entity type. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the entity type. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @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. + * The first element of the array is an object representing [EntityType]{@link google.cloud.dialogflow.v2beta1.EntityType}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getEntityType(request); + */ + getEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IEntityType, + protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getEntityType(request, options, callback); + } + createEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IEntityType, + protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest|undefined, {}|undefined + ]>; + createEntityType( + request: protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest|null|undefined, + {}|null|undefined>): void; + createEntityType( + request: protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates an entity type in the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to create a entity type for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + * @param {google.cloud.dialogflow.v2beta1.EntityType} request.entityType + * Required. The entity type to create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @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. + * The first element of the array is an object representing [EntityType]{@link google.cloud.dialogflow.v2beta1.EntityType}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createEntityType(request); + */ + createEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IEntityType, + protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createEntityType(request, options, callback); + } + updateEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IEntityType, + protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest|undefined, {}|undefined + ]>; + updateEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest|null|undefined, + {}|null|undefined>): void; + updateEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified entity type. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.EntityType} request.entityType + * Required. The entity type to update. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @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. + * The first element of the array is an object representing [EntityType]{@link google.cloud.dialogflow.v2beta1.EntityType}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateEntityType(request); + */ + updateEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IEntityType, + protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'entity_type.name': request.entityType!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateEntityType(request, options, callback); + } + deleteEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest|undefined, {}|undefined + ]>; + deleteEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest|null|undefined, + {}|null|undefined>): void; + deleteEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified entity type. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the entity type to delete. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteEntityType(request); + */ + deleteEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteEntityType(request, options, callback); + } + + batchUpdateEntityTypes( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchUpdateEntityTypes( + request: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchUpdateEntityTypes( + request: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Updates/Creates multiple entity types in the specified agent. + * Operation + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the agent to update or create entity types in. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + * @param {string} request.entityTypeBatchUri + * The URI to a Google Cloud Storage file containing entity types to update + * or create. The file format can either be a serialized proto (of + * EntityBatch type) or a JSON object. Note: The URI must start with + * "gs://". + * @param {google.cloud.dialogflow.v2beta1.EntityTypeBatch} request.entityTypeBatchInline + * The collection of entity types to update or create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.batchUpdateEntityTypes(request); + * const [response] = await operation.promise(); + */ + batchUpdateEntityTypes( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchUpdateEntityTypes(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchUpdateEntityTypes()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkBatchUpdateEntityTypesProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchUpdateEntityTypesProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchUpdateEntityTypes, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + batchDeleteEntityTypes( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchDeleteEntityTypes( + request: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchDeleteEntityTypes( + request: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Deletes entity types in the specified agent. + * Operation + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the agent to delete all entities types for. + * Supported formats: + * - `projects//agent`, + * - `projects//locations//agent`. + * @param {string[]} request.entityTypeNames + * Required. The names entity types to delete. All names must point to the + * same agent as `parent`. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.batchDeleteEntityTypes(request); + * const [response] = await operation.promise(); + */ + batchDeleteEntityTypes( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchDeleteEntityTypes(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchDeleteEntityTypes()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkBatchDeleteEntityTypesProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchDeleteEntityTypesProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchDeleteEntityTypes, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + batchCreateEntities( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchCreateEntities( + request: protos.google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchCreateEntities( + request: protos.google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Creates multiple new entities in the specified entity type. + * + * Operation + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the entity type to create entities in. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + * @param {number[]} request.entities + * Required. The entities to create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.batchCreateEntities(request); + * const [response] = await operation.promise(); + */ + batchCreateEntities( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchCreateEntities(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchCreateEntities()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkBatchCreateEntitiesProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchCreateEntitiesProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchCreateEntities, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + batchUpdateEntities( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchUpdateEntities( + request: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchUpdateEntities( + request: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Updates or creates multiple entities in the specified entity type. This + * method does not affect entities in the entity type that aren't explicitly + * specified in the request. + * + * Operation + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the entity type to update or create entities in. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + * @param {number[]} request.entities + * Required. The entities to update or create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.protobuf.FieldMask} request.updateMask + * Optional. The mask to control which fields get updated. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.batchUpdateEntities(request); + * const [response] = await operation.promise(); + */ + batchUpdateEntities( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchUpdateEntities(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchUpdateEntities()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkBatchUpdateEntitiesProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchUpdateEntitiesProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchUpdateEntities, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + batchDeleteEntities( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchDeleteEntities( + request: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchDeleteEntities( + request: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Deletes entities in the specified entity type. + * + * Operation + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the entity type to delete entries for. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + * @param {string[]} request.entityValues + * Required. The reference `values` of the entities to delete. Note that + * these are not fully-qualified names, i.e. they don't start with + * `projects/`. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.batchDeleteEntities(request); + * const [response] = await operation.promise(); + */ + batchDeleteEntities( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchDeleteEntities(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchDeleteEntities()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkBatchDeleteEntitiesProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchDeleteEntitiesProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchDeleteEntities, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + listEntityTypes( + request?: protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IEntityType[], + protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListEntityTypesResponse + ]>; + listEntityTypes( + request: protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, + protos.google.cloud.dialogflow.v2beta1.IListEntityTypesResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IEntityType>): void; + listEntityTypes( + request: protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, + protos.google.cloud.dialogflow.v2beta1.IListEntityTypesResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IEntityType>): void; +/** + * Returns the list of all entity types in the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all entity types from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [EntityType]{@link google.cloud.dialogflow.v2beta1.EntityType}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listEntityTypesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listEntityTypes( + request?: protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, + protos.google.cloud.dialogflow.v2beta1.IListEntityTypesResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IEntityType>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, + protos.google.cloud.dialogflow.v2beta1.IListEntityTypesResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IEntityType>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IEntityType[], + protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListEntityTypesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listEntityTypes(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all entity types from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [EntityType]{@link google.cloud.dialogflow.v2beta1.EntityType} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listEntityTypesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listEntityTypesStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listEntityTypes.createStream( + this.innerApiCalls.listEntityTypes as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listEntityTypes`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all entity types from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [EntityType]{@link google.cloud.dialogflow.v2beta1.EntityType}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listEntityTypesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listEntityTypesAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listEntityTypes.asyncIterate( + this.innerApiCalls['listEntityTypes'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.entityTypesStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/entity_types_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/entity_types_client_config.json new file mode 100644 index 00000000..987e4260 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/entity_types_client_config.json @@ -0,0 +1,79 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.EntityTypes": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListEntityTypes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchUpdateEntityTypes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchDeleteEntityTypes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchCreateEntities": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchUpdateEntities": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchDeleteEntities": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/entity_types_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/entity_types_proto_list.json new file mode 100644 index 00000000..cb5136f1 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/entity_types_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/environments_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/environments_client.ts new file mode 100644 index 00000000..deef1e8e --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/environments_client.ts @@ -0,0 +1,2813 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta1/environments_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './environments_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.Environment|Environments}. + * @class + * @memberof v2beta1 + */ +export class EnvironmentsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + environmentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of EnvironmentsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof EnvironmentsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listEnvironments: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'environments'), + getEnvironmentHistory: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'entries') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.Environments', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.environmentsStub) { + return this.environmentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.Environments. + this.environmentsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.Environments') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.Environments, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const environmentsStubMethods = + ['listEnvironments', 'getEnvironment', 'createEnvironment', 'updateEnvironment', 'deleteEnvironment', 'getEnvironmentHistory']; + for (const methodName of environmentsStubMethods) { + const callPromise = this.environmentsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.environmentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getEnvironment( + request?: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest|undefined, {}|undefined + ]>; + getEnvironment( + request: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest|null|undefined, + {}|null|undefined>): void; + getEnvironment( + request: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified agent environment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the environment. + * Supported formats: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * @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. + * The first element of the array is an object representing [Environment]{@link google.cloud.dialogflow.v2beta1.Environment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getEnvironment(request); + */ + getEnvironment( + request?: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getEnvironment(request, options, callback); + } + createEnvironment( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest|undefined, {}|undefined + ]>; + createEnvironment( + request: protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest|null|undefined, + {}|null|undefined>): void; + createEnvironment( + request: protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates an agent environment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to create an environment for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + * @param {google.cloud.dialogflow.v2beta1.Environment} request.environment + * Required. The environment to create. + * @param {string} request.environmentId + * Required. The unique id of the new environment. + * @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. + * The first element of the array is an object representing [Environment]{@link google.cloud.dialogflow.v2beta1.Environment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createEnvironment(request); + */ + createEnvironment( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createEnvironment(request, options, callback); + } + updateEnvironment( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest|undefined, {}|undefined + ]>; + updateEnvironment( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest|null|undefined, + {}|null|undefined>): void; + updateEnvironment( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified agent environment. + * + * This method allows you to deploy new agent versions into the environment. + * When an environment is pointed to a new agent version by setting + * `environment.agent_version`, the environment is temporarily set to the + * `LOADING` state. During that time, the environment keeps on serving the + * previous version of the agent. After the new agent version is done loading, + * the environment is set back to the `RUNNING` state. + * You can use "-" as Environment ID in environment name to update version + * in "draft" environment. WARNING: this will negate all recent changes to + * draft and can't be undone. You may want to save the draft to a version + * before calling this function. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.Environment} request.environment + * Required. The environment to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields get updated. + * @param {boolean} [request.allowLoadToDraftAndDiscardChanges] + * Optional. This field is used to prevent accidental overwrite of the draft + * environment, which is an operation that cannot be undone. To confirm that + * the caller desires this overwrite, this field must be explicitly set to + * true when updating the draft environment (environment ID = `-`). + * @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. + * The first element of the array is an object representing [Environment]{@link google.cloud.dialogflow.v2beta1.Environment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateEnvironment(request); + */ + updateEnvironment( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'environment.name': request.environment!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateEnvironment(request, options, callback); + } + deleteEnvironment( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest|undefined, {}|undefined + ]>; + deleteEnvironment( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest|null|undefined, + {}|null|undefined>): void; + deleteEnvironment( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified agent environment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the environment to delete. + * / Format: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteEnvironment(request); + */ + deleteEnvironment( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteEnvironment(request, options, callback); + } + + listEnvironments( + request?: protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IEnvironment[], + protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse + ]>; + listEnvironments( + request: protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, + protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IEnvironment>): void; + listEnvironments( + request: protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, + protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IEnvironment>): void; +/** + * Returns the list of all non-draft environments of the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all environments from. + * Format: + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [Environment]{@link google.cloud.dialogflow.v2beta1.Environment}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listEnvironmentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listEnvironments( + request?: protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, + protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IEnvironment>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, + protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IEnvironment>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IEnvironment[], + protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listEnvironments(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all environments from. + * Format: + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Environment]{@link google.cloud.dialogflow.v2beta1.Environment} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listEnvironmentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listEnvironmentsStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listEnvironments.createStream( + this.innerApiCalls.listEnvironments as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listEnvironments`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all environments from. + * Format: + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Environment]{@link google.cloud.dialogflow.v2beta1.Environment}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listEnvironmentsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listEnvironmentsAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listEnvironments.asyncIterate( + this.innerApiCalls['listEnvironments'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + getEnvironmentHistory( + request?: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry[], + protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest|null, + protos.google.cloud.dialogflow.v2beta1.IEnvironmentHistory + ]>; + getEnvironmentHistory( + request: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, + protos.google.cloud.dialogflow.v2beta1.IEnvironmentHistory|null|undefined, + protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry>): void; + getEnvironmentHistory( + request: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, + protos.google.cloud.dialogflow.v2beta1.IEnvironmentHistory|null|undefined, + protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry>): void; +/** + * Gets the history of the specified environment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the environment to retrieve history for. + * Supported formats: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [Entry]{@link google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `getEnvironmentHistoryAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + getEnvironmentHistory( + request?: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, + protos.google.cloud.dialogflow.v2beta1.IEnvironmentHistory|null|undefined, + protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, + protos.google.cloud.dialogflow.v2beta1.IEnvironmentHistory|null|undefined, + protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry[], + protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest|null, + protos.google.cloud.dialogflow.v2beta1.IEnvironmentHistory + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.getEnvironmentHistory(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the environment to retrieve history for. + * Supported formats: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Entry]{@link google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `getEnvironmentHistoryAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + getEnvironmentHistoryStream( + request?: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.getEnvironmentHistory.createStream( + this.innerApiCalls.getEnvironmentHistory as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `getEnvironmentHistory`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the environment to retrieve history for. + * Supported formats: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Entry]{@link google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.getEnvironmentHistoryAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + getEnvironmentHistoryAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.getEnvironmentHistory.asyncIterate( + this.innerApiCalls['getEnvironmentHistory'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.environmentsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/environments_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/environments_client_config.json new file mode 100644 index 00000000..4fd9caa5 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/environments_client_config.json @@ -0,0 +1,59 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.Environments": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListEnvironments": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetEnvironment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateEnvironment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateEnvironment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteEnvironment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetEnvironmentHistory": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/environments_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/environments_proto_list.json new file mode 100644 index 00000000..cb5136f1 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/environments_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/fulfillments_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/fulfillments_client.ts new file mode 100644 index 00000000..66a88957 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/fulfillments_client.ts @@ -0,0 +1,2228 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta1/fulfillments_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './fulfillments_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.Fulfillment|Fulfillments}. + * @class + * @memberof v2beta1 + */ +export class FulfillmentsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + fulfillmentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of FulfillmentsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof FulfillmentsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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}' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.Fulfillments', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.fulfillmentsStub) { + return this.fulfillmentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.Fulfillments. + this.fulfillmentsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.Fulfillments') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.Fulfillments, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const fulfillmentsStubMethods = + ['getFulfillment', 'updateFulfillment']; + for (const methodName of fulfillmentsStubMethods) { + const callPromise = this.fulfillmentsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.fulfillmentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getFulfillment( + request?: protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest|undefined, {}|undefined + ]>; + getFulfillment( + request: protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest|null|undefined, + {}|null|undefined>): void; + getFulfillment( + request: protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the fulfillment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the fulfillment. + * Supported formats: + * - `projects//agent/fulfillment` + * - `projects//locations//agent/fulfillment` + * @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. + * The first element of the array is an object representing [Fulfillment]{@link google.cloud.dialogflow.v2beta1.Fulfillment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getFulfillment(request); + */ + getFulfillment( + request?: protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getFulfillment(request, options, callback); + } + updateFulfillment( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest|undefined, {}|undefined + ]>; + updateFulfillment( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest|null|undefined, + {}|null|undefined>): void; + updateFulfillment( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the fulfillment. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.Fulfillment} request.fulfillment + * Required. The fulfillment to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields get updated. If the mask is not + * present, all fields will be updated. + * @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. + * The first element of the array is an object representing [Fulfillment]{@link google.cloud.dialogflow.v2beta1.Fulfillment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateFulfillment(request); + */ + updateFulfillment( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'fulfillment.name': request.fulfillment!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateFulfillment(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.fulfillmentsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/fulfillments_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/fulfillments_client_config.json new file mode 100644 index 00000000..b865673e --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/fulfillments_client_config.json @@ -0,0 +1,39 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.Fulfillments": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "GetFulfillment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateFulfillment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/fulfillments_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/fulfillments_proto_list.json new file mode 100644 index 00000000..cb5136f1 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/fulfillments_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/gapic_metadata.json b/owl-bot-staging/v2beta1/src/v2beta1/gapic_metadata.json new file mode 100644 index 00000000..29a7df99 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/gapic_metadata.json @@ -0,0 +1,1158 @@ +{ + "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" + ] + } + } + } + } + }, + "AnswerRecords": { + "clients": { + "grpc": { + "libraryClient": "AnswerRecordsClient", + "rpcs": { + "GetAnswerRecord": { + "methods": [ + "getAnswerRecord" + ] + }, + "UpdateAnswerRecord": { + "methods": [ + "updateAnswerRecord" + ] + }, + "ListAnswerRecords": { + "methods": [ + "listAnswerRecords", + "listAnswerRecordsStream", + "listAnswerRecordsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "AnswerRecordsClient", + "rpcs": { + "GetAnswerRecord": { + "methods": [ + "getAnswerRecord" + ] + }, + "UpdateAnswerRecord": { + "methods": [ + "updateAnswerRecord" + ] + }, + "ListAnswerRecords": { + "methods": [ + "listAnswerRecords", + "listAnswerRecordsStream", + "listAnswerRecordsAsync" + ] + } + } + } + } + }, + "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" + ] + } + } + } + } + }, + "ConversationProfiles": { + "clients": { + "grpc": { + "libraryClient": "ConversationProfilesClient", + "rpcs": { + "GetConversationProfile": { + "methods": [ + "getConversationProfile" + ] + }, + "CreateConversationProfile": { + "methods": [ + "createConversationProfile" + ] + }, + "UpdateConversationProfile": { + "methods": [ + "updateConversationProfile" + ] + }, + "DeleteConversationProfile": { + "methods": [ + "deleteConversationProfile" + ] + }, + "ListConversationProfiles": { + "methods": [ + "listConversationProfiles", + "listConversationProfilesStream", + "listConversationProfilesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ConversationProfilesClient", + "rpcs": { + "GetConversationProfile": { + "methods": [ + "getConversationProfile" + ] + }, + "CreateConversationProfile": { + "methods": [ + "createConversationProfile" + ] + }, + "UpdateConversationProfile": { + "methods": [ + "updateConversationProfile" + ] + }, + "DeleteConversationProfile": { + "methods": [ + "deleteConversationProfile" + ] + }, + "ListConversationProfiles": { + "methods": [ + "listConversationProfiles", + "listConversationProfilesStream", + "listConversationProfilesAsync" + ] + } + } + } + } + }, + "Conversations": { + "clients": { + "grpc": { + "libraryClient": "ConversationsClient", + "rpcs": { + "CreateConversation": { + "methods": [ + "createConversation" + ] + }, + "GetConversation": { + "methods": [ + "getConversation" + ] + }, + "CompleteConversation": { + "methods": [ + "completeConversation" + ] + }, + "BatchCreateMessages": { + "methods": [ + "batchCreateMessages" + ] + }, + "ListConversations": { + "methods": [ + "listConversations", + "listConversationsStream", + "listConversationsAsync" + ] + }, + "ListMessages": { + "methods": [ + "listMessages", + "listMessagesStream", + "listMessagesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ConversationsClient", + "rpcs": { + "CreateConversation": { + "methods": [ + "createConversation" + ] + }, + "GetConversation": { + "methods": [ + "getConversation" + ] + }, + "CompleteConversation": { + "methods": [ + "completeConversation" + ] + }, + "BatchCreateMessages": { + "methods": [ + "batchCreateMessages" + ] + }, + "ListConversations": { + "methods": [ + "listConversations", + "listConversationsStream", + "listConversationsAsync" + ] + }, + "ListMessages": { + "methods": [ + "listMessages", + "listMessagesStream", + "listMessagesAsync" + ] + } + } + } + } + }, + "Documents": { + "clients": { + "grpc": { + "libraryClient": "DocumentsClient", + "rpcs": { + "GetDocument": { + "methods": [ + "getDocument" + ] + }, + "CreateDocument": { + "methods": [ + "createDocument" + ] + }, + "ImportDocuments": { + "methods": [ + "importDocuments" + ] + }, + "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" + ] + }, + "ImportDocuments": { + "methods": [ + "importDocuments" + ] + }, + "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": { + "GetEnvironment": { + "methods": [ + "getEnvironment" + ] + }, + "CreateEnvironment": { + "methods": [ + "createEnvironment" + ] + }, + "UpdateEnvironment": { + "methods": [ + "updateEnvironment" + ] + }, + "DeleteEnvironment": { + "methods": [ + "deleteEnvironment" + ] + }, + "ListEnvironments": { + "methods": [ + "listEnvironments", + "listEnvironmentsStream", + "listEnvironmentsAsync" + ] + }, + "GetEnvironmentHistory": { + "methods": [ + "getEnvironmentHistory", + "getEnvironmentHistoryStream", + "getEnvironmentHistoryAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "EnvironmentsClient", + "rpcs": { + "GetEnvironment": { + "methods": [ + "getEnvironment" + ] + }, + "CreateEnvironment": { + "methods": [ + "createEnvironment" + ] + }, + "UpdateEnvironment": { + "methods": [ + "updateEnvironment" + ] + }, + "DeleteEnvironment": { + "methods": [ + "deleteEnvironment" + ] + }, + "ListEnvironments": { + "methods": [ + "listEnvironments", + "listEnvironmentsStream", + "listEnvironmentsAsync" + ] + }, + "GetEnvironmentHistory": { + "methods": [ + "getEnvironmentHistory", + "getEnvironmentHistoryStream", + "getEnvironmentHistoryAsync" + ] + } + } + } + } + }, + "Fulfillments": { + "clients": { + "grpc": { + "libraryClient": "FulfillmentsClient", + "rpcs": { + "GetFulfillment": { + "methods": [ + "getFulfillment" + ] + }, + "UpdateFulfillment": { + "methods": [ + "updateFulfillment" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "FulfillmentsClient", + "rpcs": { + "GetFulfillment": { + "methods": [ + "getFulfillment" + ] + }, + "UpdateFulfillment": { + "methods": [ + "updateFulfillment" + ] + } + } + } + } + }, + "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" + ] + } + } + } + } + }, + "Participants": { + "clients": { + "grpc": { + "libraryClient": "ParticipantsClient", + "rpcs": { + "CreateParticipant": { + "methods": [ + "createParticipant" + ] + }, + "GetParticipant": { + "methods": [ + "getParticipant" + ] + }, + "UpdateParticipant": { + "methods": [ + "updateParticipant" + ] + }, + "AnalyzeContent": { + "methods": [ + "analyzeContent" + ] + }, + "SuggestArticles": { + "methods": [ + "suggestArticles" + ] + }, + "SuggestFaqAnswers": { + "methods": [ + "suggestFaqAnswers" + ] + }, + "SuggestSmartReplies": { + "methods": [ + "suggestSmartReplies" + ] + }, + "CompileSuggestion": { + "methods": [ + "compileSuggestion" + ] + }, + "ListParticipants": { + "methods": [ + "listParticipants", + "listParticipantsStream", + "listParticipantsAsync" + ] + }, + "ListSuggestions": { + "methods": [ + "listSuggestions", + "listSuggestionsStream", + "listSuggestionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ParticipantsClient", + "rpcs": { + "CreateParticipant": { + "methods": [ + "createParticipant" + ] + }, + "GetParticipant": { + "methods": [ + "getParticipant" + ] + }, + "UpdateParticipant": { + "methods": [ + "updateParticipant" + ] + }, + "AnalyzeContent": { + "methods": [ + "analyzeContent" + ] + }, + "SuggestArticles": { + "methods": [ + "suggestArticles" + ] + }, + "SuggestFaqAnswers": { + "methods": [ + "suggestFaqAnswers" + ] + }, + "SuggestSmartReplies": { + "methods": [ + "suggestSmartReplies" + ] + }, + "CompileSuggestion": { + "methods": [ + "compileSuggestion" + ] + }, + "ListParticipants": { + "methods": [ + "listParticipants", + "listParticipantsStream", + "listParticipantsAsync" + ] + }, + "ListSuggestions": { + "methods": [ + "listSuggestions", + "listSuggestionsStream", + "listSuggestionsAsync" + ] + } + } + } + } + }, + "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" + ] + } + } + } + } + }, + "Versions": { + "clients": { + "grpc": { + "libraryClient": "VersionsClient", + "rpcs": { + "GetVersion": { + "methods": [ + "getVersion" + ] + }, + "CreateVersion": { + "methods": [ + "createVersion" + ] + }, + "UpdateVersion": { + "methods": [ + "updateVersion" + ] + }, + "DeleteVersion": { + "methods": [ + "deleteVersion" + ] + }, + "ListVersions": { + "methods": [ + "listVersions", + "listVersionsStream", + "listVersionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "VersionsClient", + "rpcs": { + "GetVersion": { + "methods": [ + "getVersion" + ] + }, + "CreateVersion": { + "methods": [ + "createVersion" + ] + }, + "UpdateVersion": { + "methods": [ + "updateVersion" + ] + }, + "DeleteVersion": { + "methods": [ + "deleteVersion" + ] + }, + "ListVersions": { + "methods": [ + "listVersions", + "listVersionsStream", + "listVersionsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/index.ts b/owl-bot-staging/v2beta1/src/v2beta1/index.ts new file mode 100644 index 00000000..7214e5d9 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/index.ts @@ -0,0 +1,33 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {AgentsClient} from './agents_client'; +export {AnswerRecordsClient} from './answer_records_client'; +export {ContextsClient} from './contexts_client'; +export {ConversationProfilesClient} from './conversation_profiles_client'; +export {ConversationsClient} from './conversations_client'; +export {DocumentsClient} from './documents_client'; +export {EntityTypesClient} from './entity_types_client'; +export {EnvironmentsClient} from './environments_client'; +export {FulfillmentsClient} from './fulfillments_client'; +export {IntentsClient} from './intents_client'; +export {KnowledgeBasesClient} from './knowledge_bases_client'; +export {ParticipantsClient} from './participants_client'; +export {SessionEntityTypesClient} from './session_entity_types_client'; +export {SessionsClient} from './sessions_client'; +export {VersionsClient} from './versions_client'; diff --git a/owl-bot-staging/v2beta1/src/v2beta1/intents_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/intents_client.ts new file mode 100644 index 00000000..cf76593b --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/intents_client.ts @@ -0,0 +1,2925 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta1/intents_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './intents_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.Intent|Intents}. + * @class + * @memberof v2beta1 + */ +export class IntentsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + intentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of IntentsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof IntentsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listIntents: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'intents') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + + this.operationsClient = this._gaxModule.lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }).operationsClient(opts); + const batchUpdateIntentsResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse') as gax.protobuf.Type; + const batchUpdateIntentsMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + const batchDeleteIntentsResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const batchDeleteIntentsMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct') as gax.protobuf.Type; + + this.descriptors.longrunning = { + batchUpdateIntents: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchUpdateIntentsResponse.decode.bind(batchUpdateIntentsResponse), + batchUpdateIntentsMetadata.decode.bind(batchUpdateIntentsMetadata)), + batchDeleteIntents: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchDeleteIntentsResponse.decode.bind(batchDeleteIntentsResponse), + batchDeleteIntentsMetadata.decode.bind(batchDeleteIntentsMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.Intents', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.intentsStub) { + return this.intentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.Intents. + this.intentsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.Intents') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.Intents, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const intentsStubMethods = + ['listIntents', 'getIntent', 'createIntent', 'updateIntent', 'deleteIntent', 'batchUpdateIntents', 'batchDeleteIntents']; + for (const methodName of intentsStubMethods) { + const callPromise = this.intentsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.intentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getIntent( + request?: protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest|undefined, {}|undefined + ]>; + getIntent( + request: protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest|null|undefined, + {}|null|undefined>): void; + getIntent( + request: protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified intent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the intent. + * Supported formats: + * + * - `projects//agent/intents/` + * - `projects//locations//agent/intents/` + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView + * Optional. The resource view to apply to the returned intent. + * @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. + * The first element of the array is an object representing [Intent]{@link google.cloud.dialogflow.v2beta1.Intent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getIntent(request); + */ + getIntent( + request?: protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getIntent(request, options, callback); + } + createIntent( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest|undefined, {}|undefined + ]>; + createIntent( + request: protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest|null|undefined, + {}|null|undefined>): void; + createIntent( + request: protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates an intent in the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to create a intent for. + * Supported formats: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {google.cloud.dialogflow.v2beta1.Intent} request.intent + * Required. The intent to create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView + * Optional. The resource view to apply to the returned intent. + * @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. + * The first element of the array is an object representing [Intent]{@link google.cloud.dialogflow.v2beta1.Intent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createIntent(request); + */ + createIntent( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createIntent(request, options, callback); + } + updateIntent( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest|undefined, {}|undefined + ]>; + updateIntent( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest|null|undefined, + {}|null|undefined>): void; + updateIntent( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified intent. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.Intent} request.intent + * Required. The intent to update. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.protobuf.FieldMask} request.updateMask + * Optional. The mask to control which fields get updated. + * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView + * Optional. The resource view to apply to the returned intent. + * @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. + * The first element of the array is an object representing [Intent]{@link google.cloud.dialogflow.v2beta1.Intent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateIntent(request); + */ + updateIntent( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'intent.name': request.intent!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateIntent(request, options, callback); + } + deleteIntent( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest|undefined, {}|undefined + ]>; + deleteIntent( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest|null|undefined, + {}|null|undefined>): void; + deleteIntent( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified intent and its direct or indirect followup intents. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the intent to delete. If this intent has direct or + * indirect followup intents, we also delete them. + * + * Supported formats: + * + * - `projects//agent/intents/` + * - `projects//locations//agent/intents/` + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteIntent(request); + */ + deleteIntent( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteIntent(request, options, callback); + } + + batchUpdateIntents( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchUpdateIntents( + request: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchUpdateIntents( + request: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Updates/Creates multiple intents in the specified agent. + * + * Operation + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the agent to update or create intents in. + * Supported formats: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {string} request.intentBatchUri + * The URI to a Google Cloud Storage file containing intents to update or + * create. The file format can either be a serialized proto (of IntentBatch + * type) or JSON object. Note: The URI must start with "gs://". + * @param {google.cloud.dialogflow.v2beta1.IntentBatch} request.intentBatchInline + * The collection of intents to update or create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.protobuf.FieldMask} request.updateMask + * Optional. The mask to control which fields get updated. + * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView + * Optional. The resource view to apply to the returned intent. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.batchUpdateIntents(request); + * const [response] = await operation.promise(); + */ + batchUpdateIntents( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchUpdateIntents(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchUpdateIntents()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkBatchUpdateIntentsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchUpdateIntentsProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchUpdateIntents, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + batchDeleteIntents( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchDeleteIntents( + request: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchDeleteIntents( + request: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Deletes intents in the specified agent. + * + * Operation + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the agent to delete all entities types for. + * Supported formats: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {number[]} request.intents + * Required. The collection of intents to delete. Only intent `name` must be + * filled in. + * @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. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.batchDeleteIntents(request); + * const [response] = await operation.promise(); + */ + batchDeleteIntents( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchDeleteIntents(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchDeleteIntents()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkBatchDeleteIntentsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchDeleteIntentsProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchDeleteIntents, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + listIntents( + request?: protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IIntent[], + protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListIntentsResponse + ]>; + listIntents( + request: protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, + protos.google.cloud.dialogflow.v2beta1.IListIntentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IIntent>): void; + listIntents( + request: protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, + protos.google.cloud.dialogflow.v2beta1.IListIntentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IIntent>): void; +/** + * Returns the list of all intents in the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all intents from. + * Format: `projects//agent` or `projects//locations//agent`. + * + * Alternatively, you can specify the environment to list intents for. + * Format: `projects//agent/environments/` + * or `projects//locations//agent/environments/`. + * Note: training phrases of the intents will not be returned for non-draft + * environment. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView + * Optional. The resource view to apply to the returned intent. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [Intent]{@link google.cloud.dialogflow.v2beta1.Intent}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listIntentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listIntents( + request?: protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, + protos.google.cloud.dialogflow.v2beta1.IListIntentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IIntent>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, + protos.google.cloud.dialogflow.v2beta1.IListIntentsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IIntent>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IIntent[], + protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListIntentsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listIntents(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all intents from. + * Format: `projects//agent` or `projects//locations//agent`. + * + * Alternatively, you can specify the environment to list intents for. + * Format: `projects//agent/environments/` + * or `projects//locations//agent/environments/`. + * Note: training phrases of the intents will not be returned for non-draft + * environment. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView + * Optional. The resource view to apply to the returned intent. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Intent]{@link google.cloud.dialogflow.v2beta1.Intent} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listIntentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listIntentsStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listIntents.createStream( + this.innerApiCalls.listIntents as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listIntents`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all intents from. + * Format: `projects//agent` or `projects//locations//agent`. + * + * Alternatively, you can specify the environment to list intents for. + * Format: `projects//agent/environments/` + * or `projects//locations//agent/environments/`. + * Note: training phrases of the intents will not be returned for non-draft + * environment. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView + * Optional. The resource view to apply to the returned intent. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Intent]{@link google.cloud.dialogflow.v2beta1.Intent}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listIntentsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listIntentsAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listIntents.asyncIterate( + this.innerApiCalls['listIntents'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.intentsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/intents_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/intents_client_config.json new file mode 100644 index 00000000..7f297576 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/intents_client_config.json @@ -0,0 +1,64 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.Intents": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListIntents": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchUpdateIntents": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchDeleteIntents": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/intents_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/intents_proto_list.json new file mode 100644 index 00000000..cb5136f1 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/intents_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_client.ts new file mode 100644 index 00000000..66d42764 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_client.ts @@ -0,0 +1,2692 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta1/knowledge_bases_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './knowledge_bases_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.KnowledgeBase|KnowledgeBases}. + * @class + * @memberof v2beta1 + */ +export class KnowledgeBasesClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + knowledgeBasesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of KnowledgeBasesClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof KnowledgeBasesClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listKnowledgeBases: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'knowledgeBases') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.KnowledgeBases', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.knowledgeBasesStub) { + return this.knowledgeBasesStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.KnowledgeBases. + this.knowledgeBasesStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.KnowledgeBases') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.KnowledgeBases, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const knowledgeBasesStubMethods = + ['listKnowledgeBases', 'getKnowledgeBase', 'createKnowledgeBase', 'deleteKnowledgeBase', 'updateKnowledgeBase']; + for (const methodName of knowledgeBasesStubMethods) { + const callPromise = this.knowledgeBasesStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.knowledgeBasesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest|undefined, {}|undefined + ]>; + getKnowledgeBase( + request: protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): void; + getKnowledgeBase( + request: protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified knowledge base. + * + * Note: The `projects.agent.knowledgeBases` resource is deprecated; + * only use `projects.knowledgeBases`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the knowledge base to retrieve. + * 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. + * The first element of the array is an object representing [KnowledgeBase]{@link google.cloud.dialogflow.v2beta1.KnowledgeBase}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getKnowledgeBase(request); + */ + getKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getKnowledgeBase(request, options, callback); + } + createKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest|undefined, {}|undefined + ]>; + createKnowledgeBase( + request: protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): void; + createKnowledgeBase( + request: protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a knowledge base. + * + * Note: The `projects.agent.knowledgeBases` resource is deprecated; + * only use `projects.knowledgeBases`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to create a knowledge base for. + * Format: `projects//locations/`. + * @param {google.cloud.dialogflow.v2beta1.KnowledgeBase} request.knowledgeBase + * Required. The knowledge base to create. + * @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. + * The first element of the array is an object representing [KnowledgeBase]{@link google.cloud.dialogflow.v2beta1.KnowledgeBase}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createKnowledgeBase(request); + */ + createKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createKnowledgeBase(request, options, callback); + } + deleteKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest|undefined, {}|undefined + ]>; + deleteKnowledgeBase( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): void; + deleteKnowledgeBase( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified knowledge base. + * + * Note: The `projects.agent.knowledgeBases` resource is deprecated; + * only use `projects.knowledgeBases`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the knowledge base to delete. + * 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. + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteKnowledgeBase(request); + */ + deleteKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteKnowledgeBase(request, options, callback); + } + updateKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest|undefined, {}|undefined + ]>; + updateKnowledgeBase( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): void; + updateKnowledgeBase( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified knowledge base. + * + * Note: The `projects.agent.knowledgeBases` resource is deprecated; + * only use `projects.knowledgeBases`. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.KnowledgeBase} request.knowledgeBase + * Required. The knowledge base to update. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Not specified means `update all`. + * Currently, only `display_name` can be updated, an InvalidArgument will be + * returned for attempting to update other fields. + * @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. + * The first element of the array is an object representing [KnowledgeBase]{@link google.cloud.dialogflow.v2beta1.KnowledgeBase}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateKnowledgeBase(request); + */ + updateKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'knowledge_base.name': request.knowledgeBase!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateKnowledgeBase(request, options, callback); + } + + listKnowledgeBases( + request?: protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase[], + protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse + ]>; + listKnowledgeBases( + request: protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, + protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase>): void; + listKnowledgeBases( + request: protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, + protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase>): void; +/** + * Returns the list of all knowledge bases of the specified agent. + * + * Note: The `projects.agent.knowledgeBases` resource is deprecated; + * only use `projects.knowledgeBases`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list of knowledge bases for. + * 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. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter knowledge bases returned by the list + * method. The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * display_name with has(:) operator + * * language_code with equals(=) operator + * + * Examples: + * + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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. + * The first element of the array is Array of [KnowledgeBase]{@link google.cloud.dialogflow.v2beta1.KnowledgeBase}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listKnowledgeBasesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listKnowledgeBases( + request?: protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, + protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, + protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase[], + protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listKnowledgeBases(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list of knowledge bases for. + * 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. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter knowledge bases returned by the list + * method. The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * display_name with has(:) operator + * * language_code with equals(=) operator + * + * Examples: + * + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [KnowledgeBase]{@link google.cloud.dialogflow.v2beta1.KnowledgeBase} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listKnowledgeBasesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listKnowledgeBasesStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listKnowledgeBases.createStream( + this.innerApiCalls.listKnowledgeBases as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listKnowledgeBases`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list of knowledge bases for. + * 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. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter knowledge bases returned by the list + * method. The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * display_name with has(:) operator + * * language_code with equals(=) operator + * + * Examples: + * + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [KnowledgeBase]{@link google.cloud.dialogflow.v2beta1.KnowledgeBase}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listKnowledgeBasesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listKnowledgeBasesAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listKnowledgeBases.asyncIterate( + this.innerApiCalls['listKnowledgeBases'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.knowledgeBasesStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_client_config.json new file mode 100644 index 00000000..f563adce --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.KnowledgeBases": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListKnowledgeBases": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetKnowledgeBase": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateKnowledgeBase": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteKnowledgeBase": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateKnowledgeBase": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_proto_list.json new file mode 100644 index 00000000..cb5136f1 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/participants_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/participants_client.ts new file mode 100644 index 00000000..e6c78308 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/participants_client.ts @@ -0,0 +1,3221 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta1/participants_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './participants_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.Participant|Participants}. + * @class + * @memberof v2beta1 + */ +export class ParticipantsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + participantsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ParticipantsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ParticipantsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listParticipants: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'participants'), + listSuggestions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'suggestions') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.Participants', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.participantsStub) { + return this.participantsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.Participants. + this.participantsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.Participants') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.Participants, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const participantsStubMethods = + ['createParticipant', 'getParticipant', 'listParticipants', 'updateParticipant', 'analyzeContent', 'suggestArticles', 'suggestFaqAnswers', 'suggestSmartReplies', 'listSuggestions', 'compileSuggestion']; + for (const methodName of participantsStubMethods) { + const callPromise = this.participantsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.participantsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createParticipant( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IParticipant, + protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest|undefined, {}|undefined + ]>; + createParticipant( + request: protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest|null|undefined, + {}|null|undefined>): void; + createParticipant( + request: protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a new participant in a conversation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource identifier of the conversation adding the participant. + * Format: `projects//locations//conversations/`. + * @param {google.cloud.dialogflow.v2beta1.Participant} request.participant + * Required. The participant to create. + * @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. + * The first element of the array is an object representing [Participant]{@link google.cloud.dialogflow.v2beta1.Participant}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createParticipant(request); + */ + createParticipant( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IParticipant, + protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createParticipant(request, options, callback); + } + getParticipant( + request?: protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IParticipant, + protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest|undefined, {}|undefined + ]>; + getParticipant( + request: protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest|null|undefined, + {}|null|undefined>): void; + getParticipant( + request: protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves a conversation participant. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the participant. Format: + * `projects//locations//conversations//participants/`. + * @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. + * The first element of the array is an object representing [Participant]{@link google.cloud.dialogflow.v2beta1.Participant}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getParticipant(request); + */ + getParticipant( + request?: protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IParticipant, + protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getParticipant(request, options, callback); + } + updateParticipant( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IParticipant, + protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest|undefined, {}|undefined + ]>; + updateParticipant( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest|null|undefined, + {}|null|undefined>): void; + updateParticipant( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified participant. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.Participant} request.participant + * Required. The participant to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to specify which fields to update. + * @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. + * The first element of the array is an object representing [Participant]{@link google.cloud.dialogflow.v2beta1.Participant}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateParticipant(request); + */ + updateParticipant( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IParticipant, + protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'participant.name': request.participant!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateParticipant(request, options, callback); + } + analyzeContent( + request?: protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse, + protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest|undefined, {}|undefined + ]>; + analyzeContent( + request: protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse, + protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest|null|undefined, + {}|null|undefined>): void; + analyzeContent( + request: protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse, + protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Adds a text (chat, for example), or audio (phone recording, for example) + * message from a participant into the conversation. + * + * Note: Always use agent versions for production traffic + * sent to virtual agents. 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.participant + * Required. The name of the participant this text comes from. + * Format: `projects//locations//conversations//participants/`. + * @param {google.cloud.dialogflow.v2beta1.TextInput} request.textInput + * The natural language text to be processed. + * @param {google.cloud.dialogflow.v2beta1.EventInput} request.eventInput + * An input event to send to Dialogflow. + * @param {google.cloud.dialogflow.v2beta1.OutputAudioConfig} request.replyAudioConfig + * Speech synthesis configuration. + * The speech synthesis settings for a virtual agent that may be configured + * for the associated conversation profile are not used when calling + * AnalyzeContent. If this configuration is not supplied, speech synthesis + * is disabled. + * @param {google.cloud.dialogflow.v2beta1.QueryParameters} request.queryParams + * Parameters for a Dialogflow virtual-agent query. + * @param {google.protobuf.Timestamp} request.messageSendTime + * Optional. The send time of the message from end user or human agent's + * perspective. It is used for identifying the same message under one + * participant. + * + * Given two messages under the same participant: + * - If send time are different regardless of whether the content of the + * messages are exactly the same, the conversation will regard them as + * two distinct messages sent by the participant. + * - If send time is the same regardless of whether the content of the + * messages are exactly the same, the conversation will regard them as + * same message, and ignore the message received later. + * + * If the value is not provided, a new request will always be regarded as a + * new message without any de-duplication. + * @param {string} request.requestId + * A unique identifier for this request. Restricted to 36 ASCII characters. + * A random UUID is recommended. + * This request is only idempotent if a `request_id` is provided. + * @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. + * The first element of the array is an object representing [AnalyzeContentResponse]{@link google.cloud.dialogflow.v2beta1.AnalyzeContentResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.analyzeContent(request); + */ + analyzeContent( + request?: protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse, + protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse, + protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse, + protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'participant': request.participant || '', + }); + this.initialize(); + return this.innerApiCalls.analyzeContent(request, options, callback); + } + suggestArticles( + request?: protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest|undefined, {}|undefined + ]>; + suggestArticles( + request: protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest|null|undefined, + {}|null|undefined>): void; + suggestArticles( + request: protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest|null|undefined, + {}|null|undefined>): void; +/** + * Gets suggested articles for a participant based on specific historical + * messages. + * + * Note that {@link google.cloud.dialogflow.v2beta1.Participants.ListSuggestions|ListSuggestions} will only list the auto-generated + * suggestions, while {@link google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion|CompileSuggestion} will try to compile suggestion + * based on the provided conversation context in the real time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + * @param {string} [request.latestMessage] + * Optional. The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * + * Format: `projects//locations//conversations//messages/`. + * @param {number} [request.contextSize] + * Optional. Max number of messages prior to and including + * {@link google.cloud.dialogflow.v2beta1.SuggestArticlesRequest.latest_message|latest_message} to use as context + * when compiling the suggestion. By default 20 and at most 50. + * @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. + * The first element of the array is an object representing [SuggestArticlesResponse]{@link google.cloud.dialogflow.v2beta1.SuggestArticlesResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.suggestArticles(request); + */ + suggestArticles( + request?: protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.suggestArticles(request, options, callback); + } + suggestFaqAnswers( + request?: protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest|undefined, {}|undefined + ]>; + suggestFaqAnswers( + request: protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest|null|undefined, + {}|null|undefined>): void; + suggestFaqAnswers( + request: protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest|null|undefined, + {}|null|undefined>): void; +/** + * Gets suggested faq answers for a participant based on specific historical + * messages. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + * @param {string} [request.latestMessage] + * Optional. The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * + * Format: `projects//locations//conversations//messages/`. + * @param {number} [request.contextSize] + * Optional. Max number of messages prior to and including + * [latest_message] to use as context when compiling the + * suggestion. By default 20 and at most 50. + * @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. + * The first element of the array is an object representing [SuggestFaqAnswersResponse]{@link google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.suggestFaqAnswers(request); + */ + suggestFaqAnswers( + request?: protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.suggestFaqAnswers(request, options, callback); + } + suggestSmartReplies( + request?: protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest|undefined, {}|undefined + ]>; + suggestSmartReplies( + request: protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest|null|undefined, + {}|null|undefined>): void; + suggestSmartReplies( + request: protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest|null|undefined, + {}|null|undefined>): void; +/** + * Gets smart replies for a participant based on specific historical + * messages. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + * @param {google.cloud.dialogflow.v2beta1.TextInput} request.currentTextInput + * The current natural language text segment to compile suggestion + * for. This provides a way for user to get follow up smart reply suggestion + * after a smart reply selection, without sending a text message. + * @param {string} request.latestMessage + * The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * + * Format: `projects//locations//conversations//messages/`. + * @param {number} request.contextSize + * Optional. Max number of messages prior to and including + * [latest_message] to use as context when compiling the + * suggestion. By default 20 and at most 50. + * @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. + * The first element of the array is an object representing [SuggestSmartRepliesResponse]{@link google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.suggestSmartReplies(request); + */ + suggestSmartReplies( + request?: protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.suggestSmartReplies(request, options, callback); + } + compileSuggestion( + request?: protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse, + protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest|undefined, {}|undefined + ]>; + compileSuggestion( + request: protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse, + protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest|null|undefined, + {}|null|undefined>): void; + compileSuggestion( + request: protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse, + protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deprecated. use {@link google.cloud.dialogflow.v2beta1.Participants.SuggestArticles|SuggestArticles} and {@link google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers|SuggestFaqAnswers} instead. + * + * Gets suggestions for a participant based on specific historical + * messages. + * + * Note that {@link google.cloud.dialogflow.v2beta1.Participants.ListSuggestions|ListSuggestions} will only list the auto-generated + * suggestions, while {@link google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion|CompileSuggestion} will try to compile suggestion + * based on the provided conversation context in the real time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + * @param {string} request.latestMessage + * Optional. The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * + * Format: `projects//locations//conversations//messages/`. + * @param {number} request.contextSize + * Optional. Max number of messages prior to and including + * [latest_message] to use as context when compiling the + * suggestion. If zero or less than zero, 20 is used. + * @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. + * The first element of the array is an object representing [CompileSuggestionResponse]{@link google.cloud.dialogflow.v2beta1.CompileSuggestionResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.compileSuggestion(request); + * @deprecated CompileSuggestion is deprecated and may be removed in a future version. + */ + compileSuggestion( + request?: protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse, + protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse, + protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse, + protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + this.warn('DEP$Participants-$CompileSuggestion','CompileSuggestion is deprecated and may be removed in a future version.', 'DeprecationWarning'); + return this.innerApiCalls.compileSuggestion(request, options, callback); + } + + listParticipants( + request?: protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IParticipant[], + protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListParticipantsResponse + ]>; + listParticipants( + request: protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, + protos.google.cloud.dialogflow.v2beta1.IListParticipantsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IParticipant>): void; + listParticipants( + request: protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, + protos.google.cloud.dialogflow.v2beta1.IListParticipantsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IParticipant>): void; +/** + * Returns the list of all participants in the specified conversation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The conversation to list all participants from. + * Format: `projects//locations//conversations/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [Participant]{@link google.cloud.dialogflow.v2beta1.Participant}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listParticipantsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listParticipants( + request?: protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, + protos.google.cloud.dialogflow.v2beta1.IListParticipantsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IParticipant>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, + protos.google.cloud.dialogflow.v2beta1.IListParticipantsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IParticipant>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IParticipant[], + protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListParticipantsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listParticipants(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The conversation to list all participants from. + * Format: `projects//locations//conversations/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Participant]{@link google.cloud.dialogflow.v2beta1.Participant} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listParticipantsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listParticipantsStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listParticipants.createStream( + this.innerApiCalls.listParticipants as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listParticipants`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The conversation to list all participants from. + * Format: `projects//locations//conversations/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Participant]{@link google.cloud.dialogflow.v2beta1.Participant}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listParticipantsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listParticipantsAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listParticipants.asyncIterate( + this.innerApiCalls['listParticipants'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + listSuggestions( + request?: protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.ISuggestion[], + protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListSuggestionsResponse + ]>; + listSuggestions( + request: protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, + protos.google.cloud.dialogflow.v2beta1.IListSuggestionsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.ISuggestion>): void; + listSuggestions( + request: protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, + protos.google.cloud.dialogflow.v2beta1.IListSuggestionsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.ISuggestion>): void; +/** + * Deprecated: Use inline suggestion, event based suggestion or + * Suggestion* API instead. + * See {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.name|HumanAgentAssistantConfig.name} for more + * details. + * Removal Date: 2020-09-01. + * + * Retrieves suggestions for live agents. + * + * This method should be used by human agent client software to fetch auto + * generated suggestions in real-time, while the conversation with an end user + * is in progress. The functionality is implemented in terms of the + * [list + * pagination](https://cloud.google.com/apis/design/design_patterns#list_pagination) + * design pattern. The client app should use the `next_page_token` field + * to fetch the next batch of suggestions. `suggestions` are sorted by + * `create_time` in descending order. + * To fetch latest suggestion, just set `page_size` to 1. + * To fetch new suggestions without duplication, send request with filter + * `create_time_epoch_microseconds > [first item's create_time of previous + * request]` and empty page_token. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the participant to fetch suggestions for. + * Format: `projects//locations//conversations//participants/`. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. The + * default value is 100; the maximum value is 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {string} request.filter + * Optional. Filter on suggestions fields. Currently predicates on + * `create_time` and `create_time_epoch_microseconds` are supported. + * `create_time` only support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > "2017-01-15T01:30:15.01Z"` + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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. + * The first element of the array is Array of [Suggestion]{@link google.cloud.dialogflow.v2beta1.Suggestion}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listSuggestionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @deprecated ListSuggestions is deprecated and may be removed in a future version. + */ + listSuggestions( + request?: protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, + protos.google.cloud.dialogflow.v2beta1.IListSuggestionsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.ISuggestion>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, + protos.google.cloud.dialogflow.v2beta1.IListSuggestionsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.ISuggestion>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.ISuggestion[], + protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListSuggestionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + this.warn('DEP$Participants-$ListSuggestions','ListSuggestions is deprecated and may be removed in a future version.', 'DeprecationWarning'); + return this.innerApiCalls.listSuggestions(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the participant to fetch suggestions for. + * Format: `projects//locations//conversations//participants/`. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. The + * default value is 100; the maximum value is 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {string} request.filter + * Optional. Filter on suggestions fields. Currently predicates on + * `create_time` and `create_time_epoch_microseconds` are supported. + * `create_time` only support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > "2017-01-15T01:30:15.01Z"` + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Suggestion]{@link google.cloud.dialogflow.v2beta1.Suggestion} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listSuggestionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @deprecated ListSuggestions is deprecated and may be removed in a future version. + */ + listSuggestionsStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + this.warn('DEP$Participants-$ListSuggestions','ListSuggestions is deprecated and may be removed in a future version.', 'DeprecationWarning'); + return this.descriptors.page.listSuggestions.createStream( + this.innerApiCalls.listSuggestions as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSuggestions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the participant to fetch suggestions for. + * Format: `projects//locations//conversations//participants/`. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. The + * default value is 100; the maximum value is 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {string} request.filter + * Optional. Filter on suggestions fields. Currently predicates on + * `create_time` and `create_time_epoch_microseconds` are supported. + * `create_time` only support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > "2017-01-15T01:30:15.01Z"` + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Suggestion]{@link google.cloud.dialogflow.v2beta1.Suggestion}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listSuggestionsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * @deprecated ListSuggestions is deprecated and may be removed in a future version. + */ + listSuggestionsAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + this.warn('DEP$Participants-$ListSuggestions','ListSuggestions is deprecated and may be removed in a future version.', 'DeprecationWarning'); + return this.descriptors.page.listSuggestions.asyncIterate( + this.innerApiCalls['listSuggestions'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.participantsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/participants_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/participants_client_config.json new file mode 100644 index 00000000..be8499af --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/participants_client_config.json @@ -0,0 +1,79 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.Participants": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateParticipant": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetParticipant": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListParticipants": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateParticipant": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "AnalyzeContent": { + "timeout_millis": 220000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SuggestArticles": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SuggestFaqAnswers": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SuggestSmartReplies": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListSuggestions": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CompileSuggestion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/participants_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/participants_proto_list.json new file mode 100644 index 00000000..cb5136f1 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/participants_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_client.ts new file mode 100644 index 00000000..57330ed8 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_client.ts @@ -0,0 +1,2724 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta1/session_entity_types_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './session_entity_types_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.SessionEntityType|SessionEntityTypes}. + * @class + * @memberof v2beta1 + */ +export class SessionEntityTypesClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + sessionEntityTypesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SessionEntityTypesClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SessionEntityTypesClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listSessionEntityTypes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sessionEntityTypes') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.SessionEntityTypes', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sessionEntityTypesStub) { + return this.sessionEntityTypesStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.SessionEntityTypes. + this.sessionEntityTypesStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.SessionEntityTypes') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.SessionEntityTypes, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sessionEntityTypesStubMethods = + ['listSessionEntityTypes', 'getSessionEntityType', 'createSessionEntityType', 'updateSessionEntityType', 'deleteSessionEntityType']; + for (const methodName of sessionEntityTypesStubMethods) { + const callPromise = this.sessionEntityTypesStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sessionEntityTypesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getSessionEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest|undefined, {}|undefined + ]>; + getSessionEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): void; + getSessionEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified session entity type. + * + * This method doesn't work with Google Assistant integration. + * Contact Dialogflow support if you need to use session entities + * with Google Assistant integration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the session entity type. Supported formats: + * - `projects//agent/sessions//entityTypes/` + * - `projects//locations//agent/sessions//entityTypes/` + * - `projects//agent/environments//users//sessions//entityTypes/` + * - `projects//locations//agent/environments/ + * /users//sessions//entityTypes/` + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @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. + * The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getSessionEntityType(request); + */ + getSessionEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getSessionEntityType(request, options, callback); + } + createSessionEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest|undefined, {}|undefined + ]>; + createSessionEntityType( + request: protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): void; + createSessionEntityType( + request: protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a session entity type. + * + * If the specified session entity type already exists, overrides the + * session entity type. + * + * This method doesn't work with Google Assistant integration. + * Contact Dialogflow support if you need to use session entities + * with Google Assistant integration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to create a session entity type for. + * Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @param {google.cloud.dialogflow.v2beta1.SessionEntityType} request.sessionEntityType + * Required. The session entity type to create. + * @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. + * The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createSessionEntityType(request); + */ + createSessionEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createSessionEntityType(request, options, callback); + } + updateSessionEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest|undefined, {}|undefined + ]>; + updateSessionEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): void; + updateSessionEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified session entity type. + * + * This method doesn't work with Google Assistant integration. + * Contact Dialogflow support if you need to use session entities + * with Google Assistant integration. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.SessionEntityType} request.sessionEntityType + * Required. The session entity type to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Optional. The mask to control which fields get updated. + * @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. + * The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateSessionEntityType(request); + */ + updateSessionEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'session_entity_type.name': request.sessionEntityType!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateSessionEntityType(request, options, callback); + } + deleteSessionEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest|undefined, {}|undefined + ]>; + deleteSessionEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): void; + deleteSessionEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified session entity type. + * + * This method doesn't work with Google Assistant integration. + * Contact Dialogflow support if you need to use session entities + * with Google Assistant integration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the entity type to delete. + * Supported formats: + * - `projects//agent/sessions//entityTypes/` + * - `projects//locations//agent/sessions//entityTypes/` + * - `projects//agent/environments//users//sessions//entityTypes/` + * - `projects//locations//agent/environments/ + * /users//sessions//entityTypes/` + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteSessionEntityType(request); + */ + deleteSessionEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteSessionEntityType(request, options, callback); + } + + listSessionEntityTypes( + request?: protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType[], + protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse + ]>; + listSessionEntityTypes( + request: protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, + protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType>): void; + listSessionEntityTypes( + request: protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, + protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType>): void; +/** + * Returns the list of all session entity types in the specified session. + * + * This method doesn't work with Google Assistant integration. + * Contact Dialogflow support if you need to use session entities + * with Google Assistant integration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to list all session entity types from. + * Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listSessionEntityTypesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listSessionEntityTypes( + request?: protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, + protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, + protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType[], + protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listSessionEntityTypes(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to list all session entity types from. + * Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listSessionEntityTypesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listSessionEntityTypesStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listSessionEntityTypes.createStream( + this.innerApiCalls.listSessionEntityTypes as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSessionEntityTypes`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to list all session entity types from. + * Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listSessionEntityTypesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listSessionEntityTypesAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listSessionEntityTypes.asyncIterate( + this.innerApiCalls['listSessionEntityTypes'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSession resource name string. + * + * @param {string} project + * @param {string} session + * @returns {string} Resource name string. + */ + projectAgentSessionPath(project:string,session:string) { + return this.pathTemplates.projectAgentSessionPathTemplate.render({ + project: project, + session: session, + }); + } + + /** + * Parse the project from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).project; + } + + /** + * Parse the session from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).session; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.sessionEntityTypesStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_client_config.json new file mode 100644 index 00000000..f007c235 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.SessionEntityTypes": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListSessionEntityTypes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetSessionEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateSessionEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateSessionEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteSessionEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_proto_list.json new file mode 100644 index 00000000..cb5136f1 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/sessions_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/sessions_client.ts new file mode 100644 index 00000000..c2aedf68 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/sessions_client.ts @@ -0,0 +1,2482 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta1/sessions_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sessions_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * A service used for session interactions. + * + * For more information, see the [API interactions + * guide](https://cloud.google.com/dialogflow/docs/api-overview). + * @class + * @memberof v2beta1 + */ +export class SessionsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + sessionsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SessionsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SessionsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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. + // Provide descriptors for these. + this.descriptors.stream = { + streamingDetectIntent: new this._gaxModule.StreamDescriptor(gax.StreamType.BIDI_STREAMING) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.Sessions', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sessionsStub) { + return this.sessionsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.Sessions. + this.sessionsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.Sessions') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.Sessions, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sessionsStubMethods = + ['detectIntent', 'streamingDetectIntent']; + for (const methodName of sessionsStubMethods) { + const callPromise = this.sessionsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.stream[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sessionsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + detectIntent( + request?: protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse, + protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest|undefined, {}|undefined + ]>; + detectIntent( + request: protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse, + protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest|null|undefined, + {}|null|undefined>): void; + detectIntent( + request: protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse, + protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest|null|undefined, + {}|null|undefined>): void; +/** + * Processes a natural language query and returns structured, actionable data + * as a result. This method is not idempotent, because it may cause contexts + * and session entity types to be updated, which in turn might affect + * results of future queries. + * + * 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 + * Required. The name of the session this query is sent to. Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment + * (`Environment ID` might be referred to as environment name at some places). + * If `User ID` is not specified, we are using "-". It's up to the API caller + * to choose an appropriate `Session ID` and `User Id`. They can be a random + * number or some type of user and session identifiers (preferably hashed). + * 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 + * Required. The input specification. It can be set to: + * + * 1. an audio config + * which instructs the speech recognizer how to process the speech audio, + * + * 2. a conversational query in the form of text, or + * + * 3. an event that specifies which intent to trigger. + * @param {google.cloud.dialogflow.v2beta1.OutputAudioConfig} request.outputAudioConfig + * Instructs the speech synthesizer how to generate the output + * audio. If this field is not set and agent-level speech synthesizer is not + * configured, no output audio is generated. + * @param {google.protobuf.FieldMask} request.outputAudioConfigMask + * Mask for {@link google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config|output_audio_config} indicating which settings in this + * request-level config should override speech synthesizer settings defined at + * agent-level. + * + * If unspecified or empty, {@link google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config|output_audio_config} replaces the agent-level + * config in its entirety. + * @param {Buffer} request.inputAudio + * The natural language speech audio to be processed. This field + * should be populated iff `query_input` is set to an input audio config. + * A single request can contain up to 1 minute of speech audio data. + * @param {object} [options] + * 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. + * The first element of the array is an object representing [DetectIntentResponse]{@link google.cloud.dialogflow.v2beta1.DetectIntentResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.detectIntent(request); + */ + detectIntent( + request?: protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse, + protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse, + protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse, + protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'session': request.session || '', + }); + this.initialize(); + return this.innerApiCalls.detectIntent(request, options, callback); + } + +/** + * Processes a natural language query in audio format in a streaming fashion + * and returns structured, actionable data as a result. This method is only + * available via the gRPC API (not REST). + * + * 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} + * An object stream which is both readable and writable. It accepts objects + * representing [StreamingDetectIntentRequest]{@link google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest} for write() method, and + * will emit objects representing [StreamingDetectIntentResponse]{@link google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse} on 'data' event asynchronously. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming) + * for more details and examples. + * @example + * const stream = client.streamingDetectIntent(); + * stream.on('data', (response) => { ... }); + * stream.on('end', () => { ... }); + * stream.write(request); + * stream.end(); + */ + streamingDetectIntent( + options?: CallOptions): + gax.CancellableStream { + this.initialize(); + return this.innerApiCalls.streamingDetectIntent(options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSession resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionPath(project:string,environment:string,user:string,session:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSession resource. + * + * @param {string} projectAgentEnvironmentUserSessionName + * A fully-qualified path representing project_agent_environment_user_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionName(projectAgentEnvironmentUserSessionName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match(projectAgentEnvironmentUserSessionName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSession resource. + * + * @param {string} projectAgentEnvironmentUserSessionName + * A fully-qualified path representing project_agent_environment_user_session resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionName(projectAgentEnvironmentUserSessionName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match(projectAgentEnvironmentUserSessionName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSession resource. + * + * @param {string} projectAgentEnvironmentUserSessionName + * A fully-qualified path representing project_agent_environment_user_session resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionName(projectAgentEnvironmentUserSessionName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match(projectAgentEnvironmentUserSessionName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSession resource. + * + * @param {string} projectAgentEnvironmentUserSessionName + * A fully-qualified path representing project_agent_environment_user_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionName(projectAgentEnvironmentUserSessionName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match(projectAgentEnvironmentUserSessionName).session; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSession resource name string. + * + * @param {string} project + * @param {string} session + * @returns {string} Resource name string. + */ + projectAgentSessionPath(project:string,session:string) { + return this.pathTemplates.projectAgentSessionPathTemplate.render({ + project: project, + session: session, + }); + } + + /** + * Parse the project from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).project; + } + + /** + * Parse the session from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).session; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSession resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionPath(project:string,location:string,environment:string,user:string,session:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSession resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionName + * A fully-qualified path representing project_location_agent_environment_user_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionName(projectLocationAgentEnvironmentUserSessionName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match(projectLocationAgentEnvironmentUserSessionName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSession resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionName + * A fully-qualified path representing project_location_agent_environment_user_session resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionName(projectLocationAgentEnvironmentUserSessionName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match(projectLocationAgentEnvironmentUserSessionName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSession resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionName + * A fully-qualified path representing project_location_agent_environment_user_session resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionName(projectLocationAgentEnvironmentUserSessionName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match(projectLocationAgentEnvironmentUserSessionName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSession resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionName + * A fully-qualified path representing project_location_agent_environment_user_session resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionName(projectLocationAgentEnvironmentUserSessionName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match(projectLocationAgentEnvironmentUserSessionName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSession resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionName + * A fully-qualified path representing project_location_agent_environment_user_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionName(projectLocationAgentEnvironmentUserSessionName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match(projectLocationAgentEnvironmentUserSessionName).session; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSession resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @returns {string} Resource name string. + */ + projectLocationAgentSessionPath(project:string,location:string,session:string) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.render({ + project: project, + location: location, + session: session, + }); + } + + /** + * Parse the project from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionName(projectLocationAgentSessionName: string) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match(projectLocationAgentSessionName).project; + } + + /** + * Parse the location from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionName(projectLocationAgentSessionName: string) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match(projectLocationAgentSessionName).location; + } + + /** + * Parse the session from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionName(projectLocationAgentSessionName: string) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match(projectLocationAgentSessionName).session; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.sessionsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/sessions_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/sessions_client_config.json new file mode 100644 index 00000000..e36850ea --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/sessions_client_config.json @@ -0,0 +1,39 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.Sessions": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "DetectIntent": { + "timeout_millis": 220000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "StreamingDetectIntent": { + "timeout_millis": 220000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/sessions_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/sessions_proto_list.json new file mode 100644 index 00000000..cb5136f1 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/sessions_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/versions_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/versions_client.ts new file mode 100644 index 00000000..9da368e3 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/versions_client.ts @@ -0,0 +1,2613 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta1/versions_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './versions_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.Version|Versions}. + * @class + * @memberof v2beta1 + */ +export class VersionsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + versionsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of VersionsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof VersionsClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + 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' + ), + projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + 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, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listVersions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'versions') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.Versions', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.versionsStub) { + return this.versionsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.Versions. + this.versionsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.Versions') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.Versions, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const versionsStubMethods = + ['listVersions', 'getVersion', 'createVersion', 'updateVersion', 'deleteVersion']; + for (const methodName of versionsStubMethods) { + const callPromise = this.versionsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.versionsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getVersion( + request?: protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest|undefined, {}|undefined + ]>; + getVersion( + request: protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest|null|undefined, + {}|null|undefined>): void; + getVersion( + request: protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified agent version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the version. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + * @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. + * The first element of the array is an object representing [Version]{@link google.cloud.dialogflow.v2beta1.Version}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getVersion(request); + */ + getVersion( + request?: protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getVersion(request, options, callback); + } + createVersion( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest|undefined, {}|undefined + ]>; + createVersion( + request: protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest|null|undefined, + {}|null|undefined>): void; + createVersion( + request: protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates an agent version. + * + * The new version points to the agent instance in the "default" environment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to create a version for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + * @param {google.cloud.dialogflow.v2beta1.Version} request.version + * Required. The version to create. + * @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. + * The first element of the array is an object representing [Version]{@link google.cloud.dialogflow.v2beta1.Version}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createVersion(request); + */ + createVersion( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createVersion(request, options, callback); + } + updateVersion( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest|undefined, {}|undefined + ]>; + updateVersion( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest|null|undefined, + {}|null|undefined>): void; + updateVersion( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified agent version. + * + * Note that this method does not allow you to update the state of the agent + * the given version points to. It allows you to update only mutable + * properties of the version resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.Version} request.version + * Required. The version to update. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields get updated. + * @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. + * The first element of the array is an object representing [Version]{@link google.cloud.dialogflow.v2beta1.Version}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateVersion(request); + */ + updateVersion( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'version.name': request.version!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateVersion(request, options, callback); + } + deleteVersion( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest|undefined, {}|undefined + ]>; + deleteVersion( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest|null|undefined, + {}|null|undefined>): void; + deleteVersion( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest|null|undefined, + {}|null|undefined>): void; +/** + * Delete the specified agent version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the version to delete. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteVersion(request); + */ + deleteVersion( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteVersion(request, options, callback); + } + + listVersions( + request?: protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IVersion[], + protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListVersionsResponse + ]>; + listVersions( + request: protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, + protos.google.cloud.dialogflow.v2beta1.IListVersionsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IVersion>): void; + listVersions( + request: protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, + protos.google.cloud.dialogflow.v2beta1.IListVersionsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IVersion>): void; +/** + * Returns the list of all versions of the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all versions from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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. + * The first element of the array is Array of [Version]{@link google.cloud.dialogflow.v2beta1.Version}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listVersionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listVersions( + request?: protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, + protos.google.cloud.dialogflow.v2beta1.IListVersionsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IVersion>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, + protos.google.cloud.dialogflow.v2beta1.IListVersionsResponse|null|undefined, + protos.google.cloud.dialogflow.v2beta1.IVersion>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.IVersion[], + protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest|null, + protos.google.cloud.dialogflow.v2beta1.IListVersionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listVersions(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all versions from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Version]{@link google.cloud.dialogflow.v2beta1.Version} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listVersionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listVersionsStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listVersions.createStream( + this.innerApiCalls.listVersions as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listVersions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all versions from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Version]{@link google.cloud.dialogflow.v2beta1.Version}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listVersionsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listVersionsAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listVersions.asyncIterate( + this.innerApiCalls['listVersions'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project:string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project:string,entityType:string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project:string,environment:string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project:string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project:string,intent:string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath(project:string,session:string,context:string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project:string,version:string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project:string,answerRecord:string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project:string,conversation:string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath(project:string,conversation:string,message:string) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { + return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath(project:string,conversation:string,participant:string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render({ + project: project, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project:string,conversationProfile:string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ + project: project, + location: location, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ + project: project, + location: location, + environment: environment, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project:string,location:string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath(project:string,location:string,intent:string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ + project: project, + location: location, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ + project: project, + location: location, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath(project:string,location:string,version:string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { + return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ + project: project, + location: location, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + participant: participant, + }); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ + project: project, + location: location, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.versionsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/versions_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/versions_client_config.json new file mode 100644 index 00000000..e748590d --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/versions_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.Versions": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListVersions": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/versions_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/versions_proto_list.json new file mode 100644 index 00000000..cb5136f1 --- /dev/null +++ b/owl-bot-staging/v2beta1/src/v2beta1/versions_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/owl-bot-staging/v2beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v2beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000..85cdb2d0 --- /dev/null +++ b/owl-bot-staging/v2beta1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,41 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const dialogflow = require('@google-cloud/dialogflow'); + +function main() { + const agentsClient = new dialogflow.AgentsClient(); + const answerRecordsClient = new dialogflow.AnswerRecordsClient(); + const contextsClient = new dialogflow.ContextsClient(); + const conversationProfilesClient = new dialogflow.ConversationProfilesClient(); + const conversationsClient = new dialogflow.ConversationsClient(); + const documentsClient = new dialogflow.DocumentsClient(); + const entityTypesClient = new dialogflow.EntityTypesClient(); + const environmentsClient = new dialogflow.EnvironmentsClient(); + const fulfillmentsClient = new dialogflow.FulfillmentsClient(); + const intentsClient = new dialogflow.IntentsClient(); + const knowledgeBasesClient = new dialogflow.KnowledgeBasesClient(); + const participantsClient = new dialogflow.ParticipantsClient(); + const sessionEntityTypesClient = new dialogflow.SessionEntityTypesClient(); + const sessionsClient = new dialogflow.SessionsClient(); + const versionsClient = new dialogflow.VersionsClient(); +} + +main(); diff --git a/owl-bot-staging/v2beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v2beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000..5a454ee2 --- /dev/null +++ b/owl-bot-staging/v2beta1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,116 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {AgentsClient, AnswerRecordsClient, ContextsClient, ConversationProfilesClient, ConversationsClient, DocumentsClient, EntityTypesClient, EnvironmentsClient, FulfillmentsClient, IntentsClient, KnowledgeBasesClient, ParticipantsClient, SessionEntityTypesClient, SessionsClient, VersionsClient} from '@google-cloud/dialogflow'; + +// check that the client class type name can be used +function doStuffWithAgentsClient(client: AgentsClient) { + client.close(); +} +function doStuffWithAnswerRecordsClient(client: AnswerRecordsClient) { + client.close(); +} +function doStuffWithContextsClient(client: ContextsClient) { + client.close(); +} +function doStuffWithConversationProfilesClient(client: ConversationProfilesClient) { + client.close(); +} +function doStuffWithConversationsClient(client: ConversationsClient) { + client.close(); +} +function doStuffWithDocumentsClient(client: DocumentsClient) { + client.close(); +} +function doStuffWithEntityTypesClient(client: EntityTypesClient) { + client.close(); +} +function doStuffWithEnvironmentsClient(client: EnvironmentsClient) { + client.close(); +} +function doStuffWithFulfillmentsClient(client: FulfillmentsClient) { + client.close(); +} +function doStuffWithIntentsClient(client: IntentsClient) { + client.close(); +} +function doStuffWithKnowledgeBasesClient(client: KnowledgeBasesClient) { + client.close(); +} +function doStuffWithParticipantsClient(client: ParticipantsClient) { + client.close(); +} +function doStuffWithSessionEntityTypesClient(client: SessionEntityTypesClient) { + client.close(); +} +function doStuffWithSessionsClient(client: SessionsClient) { + client.close(); +} +function doStuffWithVersionsClient(client: VersionsClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const agentsClient = new AgentsClient(); + doStuffWithAgentsClient(agentsClient); + // check that the client instance can be created + const answerRecordsClient = new AnswerRecordsClient(); + doStuffWithAnswerRecordsClient(answerRecordsClient); + // check that the client instance can be created + const contextsClient = new ContextsClient(); + doStuffWithContextsClient(contextsClient); + // check that the client instance can be created + const conversationProfilesClient = new ConversationProfilesClient(); + doStuffWithConversationProfilesClient(conversationProfilesClient); + // check that the client instance can be created + const conversationsClient = new ConversationsClient(); + doStuffWithConversationsClient(conversationsClient); + // check that the client instance can be created + const documentsClient = new DocumentsClient(); + doStuffWithDocumentsClient(documentsClient); + // check that the client instance can be created + const entityTypesClient = new EntityTypesClient(); + doStuffWithEntityTypesClient(entityTypesClient); + // check that the client instance can be created + const environmentsClient = new EnvironmentsClient(); + doStuffWithEnvironmentsClient(environmentsClient); + // check that the client instance can be created + const fulfillmentsClient = new FulfillmentsClient(); + doStuffWithFulfillmentsClient(fulfillmentsClient); + // check that the client instance can be created + const intentsClient = new IntentsClient(); + doStuffWithIntentsClient(intentsClient); + // check that the client instance can be created + const knowledgeBasesClient = new KnowledgeBasesClient(); + doStuffWithKnowledgeBasesClient(knowledgeBasesClient); + // check that the client instance can be created + const participantsClient = new ParticipantsClient(); + doStuffWithParticipantsClient(participantsClient); + // check that the client instance can be created + const sessionEntityTypesClient = new SessionEntityTypesClient(); + doStuffWithSessionEntityTypesClient(sessionEntityTypesClient); + // check that the client instance can be created + const sessionsClient = new SessionsClient(); + doStuffWithSessionsClient(sessionsClient); + // check that the client instance can be created + const versionsClient = new VersionsClient(); + doStuffWithVersionsClient(versionsClient); +} + +main(); diff --git a/owl-bot-staging/v2beta1/system-test/install.ts b/owl-bot-staging/v2beta1/system-test/install.ts new file mode 100644 index 00000000..1f850b52 --- /dev/null +++ b/owl-bot-staging/v2beta1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v2beta1/test/gapic_agents_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_agents_v2beta1.ts new file mode 100644 index 00000000..43ccffa5 --- /dev/null +++ b/owl-bot-staging/v2beta1/test/gapic_agents_v2beta1.ts @@ -0,0 +1,2926 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as agentsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2beta1.AgentsClient', () => { + it('has servicePath', () => { + const servicePath = agentsModule.v2beta1.AgentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = agentsModule.v2beta1.AgentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = agentsModule.v2beta1.AgentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new agentsModule.v2beta1.AgentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new agentsModule.v2beta1.AgentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.agentsStub, undefined); + await client.initialize(); + assert(client.agentsStub); + }); + + it('has close method', () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getAgent', () => { + it('invokes getAgent without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()); + client.innerApiCalls.getAgent = stubSimpleCall(expectedResponse); + const [response] = await client.getAgent(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getAgent without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()); + client.innerApiCalls.getAgent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAgent( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IAgent|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getAgent with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getAgent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAgent(request), expectedError); + assert((client.innerApiCalls.getAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('setAgent', () => { + it('invokes setAgent without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SetAgentRequest()); + request.agent = {}; + request.agent.parent = ''; + const expectedHeaderRequestParams = "agent.parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()); + client.innerApiCalls.setAgent = stubSimpleCall(expectedResponse); + const [response] = await client.setAgent(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setAgent without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SetAgentRequest()); + request.agent = {}; + request.agent.parent = ''; + const expectedHeaderRequestParams = "agent.parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()); + client.innerApiCalls.setAgent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setAgent( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IAgent|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes setAgent with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SetAgentRequest()); + request.agent = {}; + request.agent.parent = ''; + const expectedHeaderRequestParams = "agent.parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setAgent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setAgent(request), expectedError); + assert((client.innerApiCalls.setAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteAgent', () => { + it('invokes deleteAgent without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteAgent = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAgent(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteAgent without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteAgent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAgent( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteAgent with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAgent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteAgent(request), expectedError); + assert((client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getValidationResult', () => { + it('invokes getValidationResult without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetValidationResultRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ValidationResult()); + client.innerApiCalls.getValidationResult = stubSimpleCall(expectedResponse); + const [response] = await client.getValidationResult(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getValidationResult as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getValidationResult without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetValidationResultRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ValidationResult()); + client.innerApiCalls.getValidationResult = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getValidationResult( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IValidationResult|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getValidationResult as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getValidationResult with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetValidationResultRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getValidationResult = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getValidationResult(request), expectedError); + assert((client.innerApiCalls.getValidationResult as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('trainAgent', () => { + it('invokes trainAgent without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.TrainAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.trainAgent = stubLongRunningCall(expectedResponse); + const [operation] = await client.trainAgent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes trainAgent without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.TrainAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.trainAgent = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.trainAgent( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes trainAgent with call error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.TrainAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.trainAgent = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.trainAgent(request), expectedError); + assert((client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes trainAgent with LRO error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.TrainAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.trainAgent = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.trainAgent(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkTrainAgentProgress without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkTrainAgentProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkTrainAgentProgress with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkTrainAgentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('exportAgent', () => { + it('invokes exportAgent without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ExportAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.exportAgent = stubLongRunningCall(expectedResponse); + const [operation] = await client.exportAgent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes exportAgent without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ExportAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.exportAgent = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.exportAgent( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes exportAgent with call error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ExportAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.exportAgent = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.exportAgent(request), expectedError); + assert((client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes exportAgent with LRO error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ExportAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.exportAgent = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.exportAgent(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkExportAgentProgress without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkExportAgentProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkExportAgentProgress with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkExportAgentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('importAgent', () => { + it('invokes importAgent without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ImportAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.importAgent = stubLongRunningCall(expectedResponse); + const [operation] = await client.importAgent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.importAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes importAgent without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ImportAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.importAgent = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importAgent( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.importAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes importAgent with call error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ImportAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importAgent = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.importAgent(request), expectedError); + assert((client.innerApiCalls.importAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes importAgent with LRO error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ImportAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importAgent = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.importAgent(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.importAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkImportAgentProgress without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkImportAgentProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportAgentProgress with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkImportAgentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('restoreAgent', () => { + it('invokes restoreAgent without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.RestoreAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.restoreAgent = stubLongRunningCall(expectedResponse); + const [operation] = await client.restoreAgent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes restoreAgent without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.RestoreAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.restoreAgent = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreAgent( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes restoreAgent with call error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.RestoreAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreAgent = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.restoreAgent(request), expectedError); + assert((client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes restoreAgent with LRO error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.RestoreAgentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreAgent = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.restoreAgent(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkRestoreAgentProgress without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRestoreAgentProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRestoreAgentProgress with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRestoreAgentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('searchAgents', () => { + it('invokes searchAgents without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), + ]; + client.innerApiCalls.searchAgents = stubSimpleCall(expectedResponse); + const [response] = await client.searchAgents(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.searchAgents as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes searchAgents without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), + ]; + client.innerApiCalls.searchAgents = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchAgents( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IAgent[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.searchAgents as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes searchAgents with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.searchAgents = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchAgents(request), expectedError); + assert((client.innerApiCalls.searchAgents as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes searchAgentsStream without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), + ]; + client.descriptors.page.searchAgents.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.searchAgentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Agent[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Agent) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.searchAgents.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.searchAgents, request)); + assert.strictEqual( + (client.descriptors.page.searchAgents.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes searchAgentsStream with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.searchAgents.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.searchAgentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Agent[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Agent) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.searchAgents.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.searchAgents, request)); + assert.strictEqual( + (client.descriptors.page.searchAgents.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with searchAgents without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), + ]; + client.descriptors.page.searchAgents.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IAgent[] = []; + const iterable = client.searchAgentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.searchAgents.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.searchAgents.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with searchAgents with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.searchAgents.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.searchAgentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IAgent[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.searchAgents.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.searchAgents.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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/owl-bot-staging/v2beta1/test/gapic_answer_records_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_answer_records_v2beta1.ts new file mode 100644 index 00000000..97205c85 --- /dev/null +++ b/owl-bot-staging/v2beta1/test/gapic_answer_records_v2beta1.ts @@ -0,0 +1,2172 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as answerrecordsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2beta1.AnswerRecordsClient', () => { + it('has servicePath', () => { + const servicePath = answerrecordsModule.v2beta1.AnswerRecordsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = answerrecordsModule.v2beta1.AnswerRecordsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = answerrecordsModule.v2beta1.AnswerRecordsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.answerRecordsStub, undefined); + await client.initialize(); + assert(client.answerRecordsStub); + }); + + it('has close method', () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getAnswerRecord', () => { + it('invokes getAnswerRecord without error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()); + client.innerApiCalls.getAnswerRecord = stubSimpleCall(expectedResponse); + const [response] = await client.getAnswerRecord(request); + assert(stub.calledOnce); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getAnswerRecord as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getAnswerRecord without error using callback', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()); + client.innerApiCalls.getAnswerRecord = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAnswerRecord( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IAnswerRecord|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert(stub.calledOnce); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getAnswerRecord as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getAnswerRecord with error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getAnswerRecord = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAnswerRecord(request), expectedError); + assert(stub.calledOnce); + assert((client.innerApiCalls.getAnswerRecord as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateAnswerRecord', () => { + it('invokes updateAnswerRecord without error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest()); + request.answerRecord = {}; + request.answerRecord.name = ''; + const expectedHeaderRequestParams = "answer_record.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()); + client.innerApiCalls.updateAnswerRecord = stubSimpleCall(expectedResponse); + const [response] = await client.updateAnswerRecord(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateAnswerRecord as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateAnswerRecord without error using callback', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest()); + request.answerRecord = {}; + request.answerRecord.name = ''; + const expectedHeaderRequestParams = "answer_record.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()); + client.innerApiCalls.updateAnswerRecord = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAnswerRecord( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IAnswerRecord|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateAnswerRecord as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateAnswerRecord with error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest()); + request.answerRecord = {}; + request.answerRecord.name = ''; + const expectedHeaderRequestParams = "answer_record.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAnswerRecord = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateAnswerRecord(request), expectedError); + assert((client.innerApiCalls.updateAnswerRecord as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listAnswerRecords', () => { + it('invokes listAnswerRecords without error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), + ]; + client.innerApiCalls.listAnswerRecords = stubSimpleCall(expectedResponse); + const [response] = await client.listAnswerRecords(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAnswerRecords as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAnswerRecords without error using callback', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), + ]; + client.innerApiCalls.listAnswerRecords = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAnswerRecords( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IAnswerRecord[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAnswerRecords as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listAnswerRecords with error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listAnswerRecords = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAnswerRecords(request), expectedError); + assert((client.innerApiCalls.listAnswerRecords as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAnswerRecordsStream without error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), + ]; + client.descriptors.page.listAnswerRecords.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAnswerRecordsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.AnswerRecord[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.AnswerRecord) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listAnswerRecords.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAnswerRecords, request)); + assert.strictEqual( + (client.descriptors.page.listAnswerRecords.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listAnswerRecordsStream with error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listAnswerRecords.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAnswerRecordsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.AnswerRecord[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.AnswerRecord) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAnswerRecords.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAnswerRecords, request)); + assert.strictEqual( + (client.descriptors.page.listAnswerRecords.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAnswerRecords without error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), + ]; + client.descriptors.page.listAnswerRecords.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IAnswerRecord[] = []; + const iterable = client.listAnswerRecordsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAnswerRecords with error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listAnswerRecords.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAnswerRecordsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IAnswerRecord[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + 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 answerrecordsModule.v2beta1.AnswerRecordsClient({ + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + 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 answerrecordsModule.v2beta1.AnswerRecordsClient({ + 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/owl-bot-staging/v2beta1/test/gapic_contexts_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_contexts_v2beta1.ts new file mode 100644 index 00000000..5f94afdb --- /dev/null +++ b/owl-bot-staging/v2beta1/test/gapic_contexts_v2beta1.ts @@ -0,0 +1,2456 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as contextsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2beta1.ContextsClient', () => { + it('has servicePath', () => { + const servicePath = contextsModule.v2beta1.ContextsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = contextsModule.v2beta1.ContextsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = contextsModule.v2beta1.ContextsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new contextsModule.v2beta1.ContextsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new contextsModule.v2beta1.ContextsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.contextsStub, undefined); + await client.initialize(); + assert(client.contextsStub); + }); + + it('has close method', () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getContext', () => { + it('invokes getContext without error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetContextRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()); + client.innerApiCalls.getContext = stubSimpleCall(expectedResponse); + const [response] = await client.getContext(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getContext without error using callback', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetContextRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()); + client.innerApiCalls.getContext = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getContext( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IContext|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getContext with error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetContextRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getContext = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getContext(request), expectedError); + assert((client.innerApiCalls.getContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createContext', () => { + it('invokes createContext without error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateContextRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()); + client.innerApiCalls.createContext = stubSimpleCall(expectedResponse); + const [response] = await client.createContext(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createContext without error using callback', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateContextRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()); + client.innerApiCalls.createContext = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createContext( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IContext|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createContext with error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateContextRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createContext = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createContext(request), expectedError); + assert((client.innerApiCalls.createContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateContext', () => { + it('invokes updateContext without error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateContextRequest()); + request.context = {}; + request.context.name = ''; + const expectedHeaderRequestParams = "context.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()); + client.innerApiCalls.updateContext = stubSimpleCall(expectedResponse); + const [response] = await client.updateContext(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateContext without error using callback', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateContextRequest()); + request.context = {}; + request.context.name = ''; + const expectedHeaderRequestParams = "context.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()); + client.innerApiCalls.updateContext = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateContext( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IContext|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateContext with error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateContextRequest()); + request.context = {}; + request.context.name = ''; + const expectedHeaderRequestParams = "context.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateContext = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateContext(request), expectedError); + assert((client.innerApiCalls.updateContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteContext', () => { + it('invokes deleteContext without error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteContextRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteContext = stubSimpleCall(expectedResponse); + const [response] = await client.deleteContext(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteContext without error using callback', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteContextRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteContext = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteContext( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteContext with error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteContextRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteContext = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteContext(request), expectedError); + assert((client.innerApiCalls.deleteContext as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteAllContexts', () => { + it('invokes deleteAllContexts without error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteAllContexts = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAllContexts(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteAllContexts as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteAllContexts without error using callback', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteAllContexts = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAllContexts( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteAllContexts as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteAllContexts with error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAllContexts = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteAllContexts(request), expectedError); + assert((client.innerApiCalls.deleteAllContexts as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listContexts', () => { + it('invokes listContexts without error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), + ]; + client.innerApiCalls.listContexts = stubSimpleCall(expectedResponse); + const [response] = await client.listContexts(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listContexts as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listContexts without error using callback', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), + ]; + client.innerApiCalls.listContexts = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listContexts( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IContext[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listContexts as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listContexts with error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listContexts = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listContexts(request), expectedError); + assert((client.innerApiCalls.listContexts as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listContextsStream without error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), + ]; + client.descriptors.page.listContexts.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listContextsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Context[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Context) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listContexts.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listContexts, request)); + assert.strictEqual( + (client.descriptors.page.listContexts.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listContextsStream with error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listContexts.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listContextsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Context[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Context) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listContexts.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listContexts, request)); + assert.strictEqual( + (client.descriptors.page.listContexts.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listContexts without error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), + ]; + client.descriptors.page.listContexts.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IContext[] = []; + const iterable = client.listContextsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listContexts.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listContexts.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listContexts with error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listContexts.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listContextsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IContext[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listContexts.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listContexts.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSession', () => { + const fakePath = "/rendered/path/projectAgentSession"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionPath', () => { + const result = client.projectAgentSessionPath("projectValue", "sessionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionName', () => { + const result = client.matchProjectFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionName', () => { + const result = client.matchSessionFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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/owl-bot-staging/v2beta1/test/gapic_conversation_profiles_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_conversation_profiles_v2beta1.ts new file mode 100644 index 00000000..11c53ea0 --- /dev/null +++ b/owl-bot-staging/v2beta1/test/gapic_conversation_profiles_v2beta1.ts @@ -0,0 +1,2334 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as conversationprofilesModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2beta1.ConversationProfilesClient', () => { + it('has servicePath', () => { + const servicePath = conversationprofilesModule.v2beta1.ConversationProfilesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = conversationprofilesModule.v2beta1.ConversationProfilesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = conversationprofilesModule.v2beta1.ConversationProfilesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationProfilesStub, undefined); + await client.initialize(); + assert(client.conversationProfilesStub); + }); + + it('has close method', () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getConversationProfile', () => { + it('invokes getConversationProfile without error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()); + client.innerApiCalls.getConversationProfile = stubSimpleCall(expectedResponse); + const [response] = await client.getConversationProfile(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getConversationProfile without error using callback', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()); + client.innerApiCalls.getConversationProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConversationProfile( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IConversationProfile|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getConversationProfile with error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getConversationProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getConversationProfile(request), expectedError); + assert((client.innerApiCalls.getConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createConversationProfile', () => { + it('invokes createConversationProfile without error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()); + client.innerApiCalls.createConversationProfile = stubSimpleCall(expectedResponse); + const [response] = await client.createConversationProfile(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createConversationProfile without error using callback', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()); + client.innerApiCalls.createConversationProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConversationProfile( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IConversationProfile|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createConversationProfile with error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversationProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createConversationProfile(request), expectedError); + assert((client.innerApiCalls.createConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateConversationProfile', () => { + it('invokes updateConversationProfile without error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest()); + request.conversationProfile = {}; + request.conversationProfile.name = ''; + const expectedHeaderRequestParams = "conversation_profile.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()); + client.innerApiCalls.updateConversationProfile = stubSimpleCall(expectedResponse); + const [response] = await client.updateConversationProfile(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateConversationProfile without error using callback', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest()); + request.conversationProfile = {}; + request.conversationProfile.name = ''; + const expectedHeaderRequestParams = "conversation_profile.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()); + client.innerApiCalls.updateConversationProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateConversationProfile( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IConversationProfile|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateConversationProfile with error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest()); + request.conversationProfile = {}; + request.conversationProfile.name = ''; + const expectedHeaderRequestParams = "conversation_profile.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateConversationProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateConversationProfile(request), expectedError); + assert((client.innerApiCalls.updateConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteConversationProfile', () => { + it('invokes deleteConversationProfile without error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteConversationProfile = stubSimpleCall(expectedResponse); + const [response] = await client.deleteConversationProfile(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteConversationProfile without error using callback', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteConversationProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteConversationProfile( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteConversationProfile with error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConversationProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteConversationProfile(request), expectedError); + assert((client.innerApiCalls.deleteConversationProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listConversationProfiles', () => { + it('invokes listConversationProfiles without error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), + ]; + client.innerApiCalls.listConversationProfiles = stubSimpleCall(expectedResponse); + const [response] = await client.listConversationProfiles(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listConversationProfiles as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listConversationProfiles without error using callback', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), + ]; + client.innerApiCalls.listConversationProfiles = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConversationProfiles( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IConversationProfile[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listConversationProfiles as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listConversationProfiles with error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listConversationProfiles = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listConversationProfiles(request), expectedError); + assert((client.innerApiCalls.listConversationProfiles as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listConversationProfilesStream without error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), + ]; + client.descriptors.page.listConversationProfiles.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listConversationProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.ConversationProfile[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.ConversationProfile) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listConversationProfiles.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConversationProfiles, request)); + assert.strictEqual( + (client.descriptors.page.listConversationProfiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listConversationProfilesStream with error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listConversationProfiles.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listConversationProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.ConversationProfile[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.ConversationProfile) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listConversationProfiles.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConversationProfiles, request)); + assert.strictEqual( + (client.descriptors.page.listConversationProfiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listConversationProfiles without error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), + ]; + client.descriptors.page.listConversationProfiles.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IConversationProfile[] = []; + const iterable = client.listConversationProfilesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listConversationProfiles with error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listConversationProfiles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConversationProfilesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IConversationProfile[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + 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 conversationprofilesModule.v2beta1.ConversationProfilesClient({ + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + 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 conversationprofilesModule.v2beta1.ConversationProfilesClient({ + 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/owl-bot-staging/v2beta1/test/gapic_conversations_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_conversations_v2beta1.ts new file mode 100644 index 00000000..6eaf8242 --- /dev/null +++ b/owl-bot-staging/v2beta1/test/gapic_conversations_v2beta1.ts @@ -0,0 +1,2554 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as conversationsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2beta1.ConversationsClient', () => { + it('has servicePath', () => { + const servicePath = conversationsModule.v2beta1.ConversationsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = conversationsModule.v2beta1.ConversationsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = conversationsModule.v2beta1.ConversationsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new conversationsModule.v2beta1.ConversationsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationsStub, undefined); + await client.initialize(); + assert(client.conversationsStub); + }); + + it('has close method', () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createConversation', () => { + it('invokes createConversation without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateConversationRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()); + client.innerApiCalls.createConversation = stubSimpleCall(expectedResponse); + const [response] = await client.createConversation(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createConversation without error using callback', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateConversationRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()); + client.innerApiCalls.createConversation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConversation( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IConversation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createConversation with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateConversationRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createConversation(request), expectedError); + assert((client.innerApiCalls.createConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getConversation', () => { + it('invokes getConversation without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetConversationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()); + client.innerApiCalls.getConversation = stubSimpleCall(expectedResponse); + const [response] = await client.getConversation(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getConversation without error using callback', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetConversationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()); + client.innerApiCalls.getConversation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConversation( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IConversation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getConversation with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetConversationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getConversation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getConversation(request), expectedError); + assert((client.innerApiCalls.getConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('completeConversation', () => { + it('invokes completeConversation without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CompleteConversationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()); + client.innerApiCalls.completeConversation = stubSimpleCall(expectedResponse); + const [response] = await client.completeConversation(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.completeConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes completeConversation without error using callback', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CompleteConversationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()); + client.innerApiCalls.completeConversation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.completeConversation( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IConversation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.completeConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes completeConversation with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CompleteConversationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.completeConversation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.completeConversation(request), expectedError); + assert((client.innerApiCalls.completeConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('batchCreateMessages', () => { + it('invokes batchCreateMessages without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse()); + client.innerApiCalls.batchCreateMessages = stubSimpleCall(expectedResponse); + const [response] = await client.batchCreateMessages(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchCreateMessages as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchCreateMessages without error using callback', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse()); + client.innerApiCalls.batchCreateMessages = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchCreateMessages( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchCreateMessages as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchCreateMessages with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateMessages = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.batchCreateMessages(request), expectedError); + assert((client.innerApiCalls.batchCreateMessages as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listConversations', () => { + it('invokes listConversations without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), + ]; + client.innerApiCalls.listConversations = stubSimpleCall(expectedResponse); + const [response] = await client.listConversations(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listConversations as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listConversations without error using callback', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), + ]; + client.innerApiCalls.listConversations = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConversations( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IConversation[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listConversations as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listConversations with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listConversations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listConversations(request), expectedError); + assert((client.innerApiCalls.listConversations as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listConversationsStream without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), + ]; + client.descriptors.page.listConversations.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listConversationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Conversation[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Conversation) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listConversations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConversations, request)); + assert.strictEqual( + (client.descriptors.page.listConversations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listConversationsStream with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listConversations.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listConversationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Conversation[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Conversation) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listConversations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConversations, request)); + assert.strictEqual( + (client.descriptors.page.listConversations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listConversations without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), + ]; + client.descriptors.page.listConversations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IConversation[] = []; + const iterable = client.listConversationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listConversations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listConversations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listConversations with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listConversations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConversationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IConversation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listConversations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listConversations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listMessages', () => { + it('invokes listMessages without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), + ]; + client.innerApiCalls.listMessages = stubSimpleCall(expectedResponse); + const [response] = await client.listMessages(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listMessages as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listMessages without error using callback', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), + ]; + client.innerApiCalls.listMessages = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMessages( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IMessage[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listMessages as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listMessages with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listMessages = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMessages(request), expectedError); + assert((client.innerApiCalls.listMessages as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listMessagesStream without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), + ]; + client.descriptors.page.listMessages.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listMessagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Message[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Message) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMessages, request)); + assert.strictEqual( + (client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listMessagesStream with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listMessages.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listMessagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Message[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Message) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMessages, request)); + assert.strictEqual( + (client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listMessages without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), + ]; + client.descriptors.page.listMessages.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IMessage[] = []; + const iterable = client.listMessagesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listMessages.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listMessages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listMessages with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listMessages.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMessagesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IMessage[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listMessages.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listMessages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + 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 conversationsModule.v2beta1.ConversationsClient({ + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + 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 conversationsModule.v2beta1.ConversationsClient({ + 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/owl-bot-staging/v2beta1/test/gapic_documents_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_documents_v2beta1.ts new file mode 100644 index 00000000..1b9a4f40 --- /dev/null +++ b/owl-bot-staging/v2beta1/test/gapic_documents_v2beta1.ts @@ -0,0 +1,2819 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as documentsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2beta1.DocumentsClient', () => { + it('has servicePath', () => { + const servicePath = documentsModule.v2beta1.DocumentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = documentsModule.v2beta1.DocumentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = documentsModule.v2beta1.DocumentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new documentsModule.v2beta1.DocumentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.documentsStub, undefined); + await client.initialize(); + assert(client.documentsStub); + }); + + it('has close method', () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getDocument', () => { + it('invokes getDocument without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()); + client.innerApiCalls.getDocument = stubSimpleCall(expectedResponse); + const [response] = await client.getDocument(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getDocument without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()); + client.innerApiCalls.getDocument = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDocument( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IDocument|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getDocument with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getDocument = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getDocument(request), expectedError); + assert((client.innerApiCalls.getDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createDocument', () => { + it('invokes createDocument without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateDocumentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createDocument = stubLongRunningCall(expectedResponse); + const [operation] = await client.createDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createDocument without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateDocumentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createDocument = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDocument( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createDocument with call error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateDocumentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createDocument = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createDocument(request), expectedError); + assert((client.innerApiCalls.createDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createDocument with LRO error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateDocumentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createDocument = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createDocument(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateDocumentProgress without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateDocumentProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateDocumentProgress with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateDocumentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('importDocuments', () => { + it('invokes importDocuments without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.importDocuments = stubLongRunningCall(expectedResponse); + const [operation] = await client.importDocuments(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.importDocuments as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes importDocuments without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.importDocuments = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importDocuments( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.importDocuments as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes importDocuments with call error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importDocuments = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.importDocuments(request), expectedError); + assert((client.innerApiCalls.importDocuments as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes importDocuments with LRO error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importDocuments = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.importDocuments(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.importDocuments as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkImportDocumentsProgress without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkImportDocumentsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportDocumentsProgress with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkImportDocumentsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteDocument', () => { + it('invokes deleteDocument without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteDocument = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteDocument without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteDocument = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDocument( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteDocument with call error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDocument = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteDocument(request), expectedError); + assert((client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteDocument with LRO error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDocument = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteDocument(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteDocumentProgress without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteDocumentProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteDocumentProgress with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteDocumentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateDocument', () => { + it('invokes updateDocument without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest()); + request.document = {}; + request.document.name = ''; + const expectedHeaderRequestParams = "document.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateDocument = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateDocument without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest()); + request.document = {}; + request.document.name = ''; + const expectedHeaderRequestParams = "document.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateDocument = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDocument( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateDocument with call error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest()); + request.document = {}; + request.document.name = ''; + const expectedHeaderRequestParams = "document.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDocument = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateDocument(request), expectedError); + assert((client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateDocument with LRO error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest()); + request.document = {}; + request.document.name = ''; + const expectedHeaderRequestParams = "document.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDocument = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateDocument(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateDocumentProgress without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateDocumentProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateDocumentProgress with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateDocumentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('reloadDocument', () => { + it('invokes reloadDocument without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.reloadDocument = stubLongRunningCall(expectedResponse); + const [operation] = await client.reloadDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes reloadDocument without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.reloadDocument = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.reloadDocument( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes reloadDocument with call error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.reloadDocument = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.reloadDocument(request), expectedError); + assert((client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes reloadDocument with LRO error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.reloadDocument = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.reloadDocument(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkReloadDocumentProgress without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkReloadDocumentProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkReloadDocumentProgress with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkReloadDocumentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listDocuments', () => { + it('invokes listDocuments without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), + ]; + client.innerApiCalls.listDocuments = stubSimpleCall(expectedResponse); + const [response] = await client.listDocuments(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listDocuments as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listDocuments without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), + ]; + client.innerApiCalls.listDocuments = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDocuments( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IDocument[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listDocuments as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listDocuments with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listDocuments = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDocuments(request), expectedError); + assert((client.innerApiCalls.listDocuments as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listDocumentsStream without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), + ]; + client.descriptors.page.listDocuments.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listDocumentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Document[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Document) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDocuments, request)); + assert.strictEqual( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listDocumentsStream with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listDocuments.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listDocumentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Document[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Document) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDocuments, request)); + assert.strictEqual( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listDocuments without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), + ]; + client.descriptors.page.listDocuments.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IDocument[] = []; + const iterable = client.listDocumentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listDocuments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listDocuments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listDocuments with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listDocuments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDocumentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IDocument[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listDocuments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listDocuments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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/owl-bot-staging/v2beta1/test/gapic_entity_types_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_entity_types_v2beta1.ts new file mode 100644 index 00000000..cce78f0a --- /dev/null +++ b/owl-bot-staging/v2beta1/test/gapic_entity_types_v2beta1.ts @@ -0,0 +1,3070 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as entitytypesModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2beta1.EntityTypesClient', () => { + it('has servicePath', () => { + const servicePath = entitytypesModule.v2beta1.EntityTypesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = entitytypesModule.v2beta1.EntityTypesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = entitytypesModule.v2beta1.EntityTypesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.entityTypesStub, undefined); + await client.initialize(); + assert(client.entityTypesStub); + }); + + it('has close method', () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getEntityType', () => { + it('invokes getEntityType without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()); + client.innerApiCalls.getEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.getEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getEntityType without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()); + client.innerApiCalls.getEntityType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEntityType( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IEntityType|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getEntityType with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getEntityType(request), expectedError); + assert((client.innerApiCalls.getEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createEntityType', () => { + it('invokes createEntityType without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()); + client.innerApiCalls.createEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.createEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createEntityType without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()); + client.innerApiCalls.createEntityType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createEntityType( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IEntityType|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createEntityType with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createEntityType(request), expectedError); + assert((client.innerApiCalls.createEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateEntityType', () => { + it('invokes updateEntityType without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest()); + request.entityType = {}; + request.entityType.name = ''; + const expectedHeaderRequestParams = "entity_type.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()); + client.innerApiCalls.updateEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.updateEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateEntityType without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest()); + request.entityType = {}; + request.entityType.name = ''; + const expectedHeaderRequestParams = "entity_type.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()); + client.innerApiCalls.updateEntityType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateEntityType( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IEntityType|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateEntityType with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest()); + request.entityType = {}; + request.entityType.name = ''; + const expectedHeaderRequestParams = "entity_type.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateEntityType(request), expectedError); + assert((client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteEntityType', () => { + it('invokes deleteEntityType without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.deleteEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteEntityType without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteEntityType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteEntityType( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteEntityType with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteEntityType(request), expectedError); + assert((client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('batchUpdateEntityTypes', () => { + it('invokes batchUpdateEntityTypes without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchUpdateEntityTypes(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchUpdateEntityTypes without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchUpdateEntityTypes( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchUpdateEntityTypes with call error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchUpdateEntityTypes(request), expectedError); + assert((client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchUpdateEntityTypes with LRO error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchUpdateEntityTypes(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkBatchUpdateEntityTypesProgress without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchUpdateEntityTypesProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchUpdateEntityTypesProgress with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBatchUpdateEntityTypesProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('batchDeleteEntityTypes', () => { + it('invokes batchDeleteEntityTypes without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchDeleteEntityTypes(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchDeleteEntityTypes without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchDeleteEntityTypes( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchDeleteEntityTypes with call error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchDeleteEntityTypes(request), expectedError); + assert((client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchDeleteEntityTypes with LRO error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchDeleteEntityTypes(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkBatchDeleteEntityTypesProgress without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchDeleteEntityTypesProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchDeleteEntityTypesProgress with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBatchDeleteEntityTypesProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('batchCreateEntities', () => { + it('invokes batchCreateEntities without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchCreateEntities = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchCreateEntities(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchCreateEntities without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchCreateEntities = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchCreateEntities( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchCreateEntities with call error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateEntities = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchCreateEntities(request), expectedError); + assert((client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchCreateEntities with LRO error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateEntities = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchCreateEntities(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkBatchCreateEntitiesProgress without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchCreateEntitiesProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchCreateEntitiesProgress with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBatchCreateEntitiesProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('batchUpdateEntities', () => { + it('invokes batchUpdateEntities without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchUpdateEntities = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchUpdateEntities(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchUpdateEntities without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchUpdateEntities = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchUpdateEntities( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchUpdateEntities with call error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntities = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchUpdateEntities(request), expectedError); + assert((client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchUpdateEntities with LRO error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntities = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchUpdateEntities(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkBatchUpdateEntitiesProgress without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchUpdateEntitiesProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchUpdateEntitiesProgress with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBatchUpdateEntitiesProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('batchDeleteEntities', () => { + it('invokes batchDeleteEntities without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchDeleteEntities = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchDeleteEntities(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchDeleteEntities without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchDeleteEntities = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchDeleteEntities( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchDeleteEntities with call error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntities = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchDeleteEntities(request), expectedError); + assert((client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchDeleteEntities with LRO error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntities = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchDeleteEntities(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkBatchDeleteEntitiesProgress without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchDeleteEntitiesProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchDeleteEntitiesProgress with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBatchDeleteEntitiesProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listEntityTypes', () => { + it('invokes listEntityTypes without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), + ]; + client.innerApiCalls.listEntityTypes = stubSimpleCall(expectedResponse); + const [response] = await client.listEntityTypes(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listEntityTypes without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), + ]; + client.innerApiCalls.listEntityTypes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listEntityTypes( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IEntityType[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listEntityTypes with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listEntityTypes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listEntityTypes(request), expectedError); + assert((client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listEntityTypesStream without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), + ]; + client.descriptors.page.listEntityTypes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listEntityTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.EntityType[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.EntityType) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listEntityTypes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listEntityTypes, request)); + assert.strictEqual( + (client.descriptors.page.listEntityTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listEntityTypesStream with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listEntityTypes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listEntityTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.EntityType[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.EntityType) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listEntityTypes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listEntityTypes, request)); + assert.strictEqual( + (client.descriptors.page.listEntityTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listEntityTypes without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), + ]; + client.descriptors.page.listEntityTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IEntityType[] = []; + const iterable = client.listEntityTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listEntityTypes with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listEntityTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listEntityTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IEntityType[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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/owl-bot-staging/v2beta1/test/gapic_environments_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_environments_v2beta1.ts new file mode 100644 index 00000000..f202bbf9 --- /dev/null +++ b/owl-bot-staging/v2beta1/test/gapic_environments_v2beta1.ts @@ -0,0 +1,2557 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as environmentsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2beta1.EnvironmentsClient', () => { + it('has servicePath', () => { + const servicePath = environmentsModule.v2beta1.EnvironmentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = environmentsModule.v2beta1.EnvironmentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = environmentsModule.v2beta1.EnvironmentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.environmentsStub, undefined); + await client.initialize(); + assert(client.environmentsStub); + }); + + it('has close method', () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getEnvironment', () => { + it('invokes getEnvironment without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()); + client.innerApiCalls.getEnvironment = stubSimpleCall(expectedResponse); + const [response] = await client.getEnvironment(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getEnvironment without error using callback', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()); + client.innerApiCalls.getEnvironment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEnvironment( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IEnvironment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getEnvironment with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getEnvironment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getEnvironment(request), expectedError); + assert((client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createEnvironment', () => { + it('invokes createEnvironment without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()); + client.innerApiCalls.createEnvironment = stubSimpleCall(expectedResponse); + const [response] = await client.createEnvironment(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createEnvironment without error using callback', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()); + client.innerApiCalls.createEnvironment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createEnvironment( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IEnvironment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createEnvironment with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createEnvironment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createEnvironment(request), expectedError); + assert((client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateEnvironment', () => { + it('invokes updateEnvironment without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest()); + request.environment = {}; + request.environment.name = ''; + const expectedHeaderRequestParams = "environment.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()); + client.innerApiCalls.updateEnvironment = stubSimpleCall(expectedResponse); + const [response] = await client.updateEnvironment(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateEnvironment without error using callback', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest()); + request.environment = {}; + request.environment.name = ''; + const expectedHeaderRequestParams = "environment.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()); + client.innerApiCalls.updateEnvironment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateEnvironment( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IEnvironment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateEnvironment with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest()); + request.environment = {}; + request.environment.name = ''; + const expectedHeaderRequestParams = "environment.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEnvironment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateEnvironment(request), expectedError); + assert((client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteEnvironment', () => { + it('invokes deleteEnvironment without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteEnvironment = stubSimpleCall(expectedResponse); + const [response] = await client.deleteEnvironment(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteEnvironment without error using callback', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteEnvironment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteEnvironment( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteEnvironment with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteEnvironment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteEnvironment(request), expectedError); + assert((client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listEnvironments', () => { + it('invokes listEnvironments without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), + ]; + client.innerApiCalls.listEnvironments = stubSimpleCall(expectedResponse); + const [response] = await client.listEnvironments(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listEnvironments without error using callback', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), + ]; + client.innerApiCalls.listEnvironments = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listEnvironments( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IEnvironment[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listEnvironments with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listEnvironments = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listEnvironments(request), expectedError); + assert((client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listEnvironmentsStream without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), + ]; + client.descriptors.page.listEnvironments.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listEnvironmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Environment[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Environment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listEnvironments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listEnvironments, request)); + assert.strictEqual( + (client.descriptors.page.listEnvironments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listEnvironmentsStream with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listEnvironments.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listEnvironmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Environment[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Environment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listEnvironments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listEnvironments, request)); + assert.strictEqual( + (client.descriptors.page.listEnvironments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listEnvironments without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), + ]; + client.descriptors.page.listEnvironments.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IEnvironment[] = []; + const iterable = client.listEnvironmentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listEnvironments with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listEnvironments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listEnvironmentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IEnvironment[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('getEnvironmentHistory', () => { + it('invokes getEnvironmentHistory without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), + ]; + client.innerApiCalls.getEnvironmentHistory = stubSimpleCall(expectedResponse); + const [response] = await client.getEnvironmentHistory(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getEnvironmentHistory as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getEnvironmentHistory without error using callback', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), + ]; + client.innerApiCalls.getEnvironmentHistory = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEnvironmentHistory( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getEnvironmentHistory as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getEnvironmentHistory with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getEnvironmentHistory = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getEnvironmentHistory(request), expectedError); + assert((client.innerApiCalls.getEnvironmentHistory as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getEnvironmentHistoryStream without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), + ]; + client.descriptors.page.getEnvironmentHistory.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.getEnvironmentHistoryStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.getEnvironmentHistory, request)); + assert.strictEqual( + (client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes getEnvironmentHistoryStream with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.getEnvironmentHistory.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.getEnvironmentHistoryStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.getEnvironmentHistory, request)); + assert.strictEqual( + (client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with getEnvironmentHistory without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), + ]; + client.descriptors.page.getEnvironmentHistory.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry[] = []; + const iterable = client.getEnvironmentHistoryAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with getEnvironmentHistory with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.getEnvironmentHistory.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.getEnvironmentHistoryAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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/owl-bot-staging/v2beta1/test/gapic_fulfillments_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_fulfillments_v2beta1.ts new file mode 100644 index 00000000..bbbd0052 --- /dev/null +++ b/owl-bot-staging/v2beta1/test/gapic_fulfillments_v2beta1.ts @@ -0,0 +1,1866 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as fulfillmentsModule from '../src'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +describe('v2beta1.FulfillmentsClient', () => { + it('has servicePath', () => { + const servicePath = fulfillmentsModule.v2beta1.FulfillmentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = fulfillmentsModule.v2beta1.FulfillmentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = fulfillmentsModule.v2beta1.FulfillmentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.fulfillmentsStub, undefined); + await client.initialize(); + assert(client.fulfillmentsStub); + }); + + it('has close method', () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getFulfillment', () => { + it('invokes getFulfillment without error', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Fulfillment()); + client.innerApiCalls.getFulfillment = stubSimpleCall(expectedResponse); + const [response] = await client.getFulfillment(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getFulfillment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getFulfillment without error using callback', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Fulfillment()); + client.innerApiCalls.getFulfillment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFulfillment( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IFulfillment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getFulfillment as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getFulfillment with error', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getFulfillment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFulfillment(request), expectedError); + assert((client.innerApiCalls.getFulfillment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateFulfillment', () => { + it('invokes updateFulfillment without error', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest()); + request.fulfillment = {}; + request.fulfillment.name = ''; + const expectedHeaderRequestParams = "fulfillment.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Fulfillment()); + client.innerApiCalls.updateFulfillment = stubSimpleCall(expectedResponse); + const [response] = await client.updateFulfillment(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateFulfillment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateFulfillment without error using callback', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest()); + request.fulfillment = {}; + request.fulfillment.name = ''; + const expectedHeaderRequestParams = "fulfillment.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Fulfillment()); + client.innerApiCalls.updateFulfillment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFulfillment( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IFulfillment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateFulfillment as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateFulfillment with error', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest()); + request.fulfillment = {}; + request.fulfillment.name = ''; + const expectedHeaderRequestParams = "fulfillment.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFulfillment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateFulfillment(request), expectedError); + assert((client.innerApiCalls.updateFulfillment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('Path templates', () => { + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + 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 fulfillmentsModule.v2beta1.FulfillmentsClient({ + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + 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 fulfillmentsModule.v2beta1.FulfillmentsClient({ + 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/owl-bot-staging/v2beta1/test/gapic_intents_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_intents_v2beta1.ts new file mode 100644 index 00000000..f35e2f58 --- /dev/null +++ b/owl-bot-staging/v2beta1/test/gapic_intents_v2beta1.ts @@ -0,0 +1,2638 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as intentsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2beta1.IntentsClient', () => { + it('has servicePath', () => { + const servicePath = intentsModule.v2beta1.IntentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = intentsModule.v2beta1.IntentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = intentsModule.v2beta1.IntentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new intentsModule.v2beta1.IntentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new intentsModule.v2beta1.IntentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.intentsStub, undefined); + await client.initialize(); + assert(client.intentsStub); + }); + + it('has close method', () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getIntent', () => { + it('invokes getIntent without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetIntentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()); + client.innerApiCalls.getIntent = stubSimpleCall(expectedResponse); + const [response] = await client.getIntent(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getIntent without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetIntentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()); + client.innerApiCalls.getIntent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIntent( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IIntent|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getIntent with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetIntentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIntent(request), expectedError); + assert((client.innerApiCalls.getIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createIntent', () => { + it('invokes createIntent without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateIntentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()); + client.innerApiCalls.createIntent = stubSimpleCall(expectedResponse); + const [response] = await client.createIntent(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createIntent without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateIntentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()); + client.innerApiCalls.createIntent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createIntent( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IIntent|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createIntent with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateIntentRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createIntent(request), expectedError); + assert((client.innerApiCalls.createIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateIntent', () => { + it('invokes updateIntent without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateIntentRequest()); + request.intent = {}; + request.intent.name = ''; + const expectedHeaderRequestParams = "intent.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()); + client.innerApiCalls.updateIntent = stubSimpleCall(expectedResponse); + const [response] = await client.updateIntent(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateIntent without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateIntentRequest()); + request.intent = {}; + request.intent.name = ''; + const expectedHeaderRequestParams = "intent.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()); + client.innerApiCalls.updateIntent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateIntent( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IIntent|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateIntent with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateIntentRequest()); + request.intent = {}; + request.intent.name = ''; + const expectedHeaderRequestParams = "intent.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateIntent(request), expectedError); + assert((client.innerApiCalls.updateIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteIntent', () => { + it('invokes deleteIntent without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteIntentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteIntent = stubSimpleCall(expectedResponse); + const [response] = await client.deleteIntent(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteIntent without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteIntentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteIntent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteIntent( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteIntent with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteIntentRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteIntent(request), expectedError); + assert((client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('batchUpdateIntents', () => { + it('invokes batchUpdateIntents without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchUpdateIntents = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchUpdateIntents(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchUpdateIntents without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchUpdateIntents = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchUpdateIntents( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchUpdateIntents with call error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateIntents = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchUpdateIntents(request), expectedError); + assert((client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchUpdateIntents with LRO error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateIntents = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchUpdateIntents(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkBatchUpdateIntentsProgress without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchUpdateIntentsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchUpdateIntentsProgress with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBatchUpdateIntentsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('batchDeleteIntents', () => { + it('invokes batchDeleteIntents without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchDeleteIntents = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchDeleteIntents(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchDeleteIntents without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchDeleteIntents = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchDeleteIntents( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchDeleteIntents with call error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteIntents = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchDeleteIntents(request), expectedError); + assert((client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchDeleteIntents with LRO error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteIntents = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchDeleteIntents(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkBatchDeleteIntentsProgress without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchDeleteIntentsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchDeleteIntentsProgress with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBatchDeleteIntentsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listIntents', () => { + it('invokes listIntents without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), + ]; + client.innerApiCalls.listIntents = stubSimpleCall(expectedResponse); + const [response] = await client.listIntents(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listIntents without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), + ]; + client.innerApiCalls.listIntents = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listIntents( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IIntent[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listIntents with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listIntents = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listIntents(request), expectedError); + assert((client.innerApiCalls.listIntents as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listIntentsStream without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), + ]; + client.descriptors.page.listIntents.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listIntentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Intent[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Intent) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listIntents.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listIntents, request)); + assert.strictEqual( + (client.descriptors.page.listIntents.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listIntentsStream with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listIntents.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listIntentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Intent[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Intent) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listIntents.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listIntents, request)); + assert.strictEqual( + (client.descriptors.page.listIntents.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listIntents without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), + ]; + client.descriptors.page.listIntents.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IIntent[] = []; + const iterable = client.listIntentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listIntents.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listIntents.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listIntents with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listIntents.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listIntentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IIntent[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listIntents.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listIntents.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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/owl-bot-staging/v2beta1/test/gapic_knowledge_bases_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_knowledge_bases_v2beta1.ts new file mode 100644 index 00000000..1756d92f --- /dev/null +++ b/owl-bot-staging/v2beta1/test/gapic_knowledge_bases_v2beta1.ts @@ -0,0 +1,2334 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as knowledgebasesModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2beta1.KnowledgeBasesClient', () => { + it('has servicePath', () => { + const servicePath = knowledgebasesModule.v2beta1.KnowledgeBasesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = knowledgebasesModule.v2beta1.KnowledgeBasesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = knowledgebasesModule.v2beta1.KnowledgeBasesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.knowledgeBasesStub, undefined); + await client.initialize(); + assert(client.knowledgeBasesStub); + }); + + it('has close method', () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getKnowledgeBase', () => { + it('invokes getKnowledgeBase without error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()); + client.innerApiCalls.getKnowledgeBase = stubSimpleCall(expectedResponse); + const [response] = await client.getKnowledgeBase(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getKnowledgeBase without error using callback', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()); + client.innerApiCalls.getKnowledgeBase = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getKnowledgeBase( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getKnowledgeBase with error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getKnowledgeBase = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getKnowledgeBase(request), expectedError); + assert((client.innerApiCalls.getKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createKnowledgeBase', () => { + it('invokes createKnowledgeBase without error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()); + client.innerApiCalls.createKnowledgeBase = stubSimpleCall(expectedResponse); + const [response] = await client.createKnowledgeBase(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createKnowledgeBase without error using callback', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()); + client.innerApiCalls.createKnowledgeBase = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createKnowledgeBase( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createKnowledgeBase with error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createKnowledgeBase = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createKnowledgeBase(request), expectedError); + assert((client.innerApiCalls.createKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteKnowledgeBase', () => { + it('invokes deleteKnowledgeBase without error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteKnowledgeBase = stubSimpleCall(expectedResponse); + const [response] = await client.deleteKnowledgeBase(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteKnowledgeBase without error using callback', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteKnowledgeBase = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteKnowledgeBase( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteKnowledgeBase with error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteKnowledgeBase = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteKnowledgeBase(request), expectedError); + assert((client.innerApiCalls.deleteKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateKnowledgeBase', () => { + it('invokes updateKnowledgeBase without error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest()); + request.knowledgeBase = {}; + request.knowledgeBase.name = ''; + const expectedHeaderRequestParams = "knowledge_base.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()); + client.innerApiCalls.updateKnowledgeBase = stubSimpleCall(expectedResponse); + const [response] = await client.updateKnowledgeBase(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateKnowledgeBase without error using callback', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest()); + request.knowledgeBase = {}; + request.knowledgeBase.name = ''; + const expectedHeaderRequestParams = "knowledge_base.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()); + client.innerApiCalls.updateKnowledgeBase = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateKnowledgeBase( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateKnowledgeBase with error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest()); + request.knowledgeBase = {}; + request.knowledgeBase.name = ''; + const expectedHeaderRequestParams = "knowledge_base.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateKnowledgeBase = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateKnowledgeBase(request), expectedError); + assert((client.innerApiCalls.updateKnowledgeBase as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listKnowledgeBases', () => { + it('invokes listKnowledgeBases without error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), + ]; + client.innerApiCalls.listKnowledgeBases = stubSimpleCall(expectedResponse); + const [response] = await client.listKnowledgeBases(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listKnowledgeBases as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listKnowledgeBases without error using callback', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), + ]; + client.innerApiCalls.listKnowledgeBases = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listKnowledgeBases( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listKnowledgeBases as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listKnowledgeBases with error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listKnowledgeBases = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listKnowledgeBases(request), expectedError); + assert((client.innerApiCalls.listKnowledgeBases as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listKnowledgeBasesStream without error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), + ]; + client.descriptors.page.listKnowledgeBases.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listKnowledgeBasesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.KnowledgeBase[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.KnowledgeBase) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listKnowledgeBases.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listKnowledgeBases, request)); + assert.strictEqual( + (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listKnowledgeBasesStream with error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listKnowledgeBases.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listKnowledgeBasesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.KnowledgeBase[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.KnowledgeBase) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listKnowledgeBases.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listKnowledgeBases, request)); + assert.strictEqual( + (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listKnowledgeBases without error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), + ]; + client.descriptors.page.listKnowledgeBases.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase[] = []; + const iterable = client.listKnowledgeBasesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listKnowledgeBases with error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listKnowledgeBases.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listKnowledgeBasesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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/owl-bot-staging/v2beta1/test/gapic_participants_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_participants_v2beta1.ts new file mode 100644 index 00000000..622f0163 --- /dev/null +++ b/owl-bot-staging/v2beta1/test/gapic_participants_v2beta1.ts @@ -0,0 +1,2913 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as participantsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2beta1.ParticipantsClient', () => { + it('has servicePath', () => { + const servicePath = participantsModule.v2beta1.ParticipantsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = participantsModule.v2beta1.ParticipantsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = participantsModule.v2beta1.ParticipantsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new participantsModule.v2beta1.ParticipantsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.participantsStub, undefined); + await client.initialize(); + assert(client.participantsStub); + }); + + it('has close method', () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createParticipant', () => { + it('invokes createParticipant without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateParticipantRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()); + client.innerApiCalls.createParticipant = stubSimpleCall(expectedResponse); + const [response] = await client.createParticipant(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createParticipant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createParticipant without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateParticipantRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()); + client.innerApiCalls.createParticipant = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createParticipant( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IParticipant|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createParticipant as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createParticipant with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateParticipantRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createParticipant = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createParticipant(request), expectedError); + assert((client.innerApiCalls.createParticipant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getParticipant', () => { + it('invokes getParticipant without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetParticipantRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()); + client.innerApiCalls.getParticipant = stubSimpleCall(expectedResponse); + const [response] = await client.getParticipant(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getParticipant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getParticipant without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetParticipantRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()); + client.innerApiCalls.getParticipant = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getParticipant( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IParticipant|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getParticipant as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getParticipant with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetParticipantRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getParticipant = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getParticipant(request), expectedError); + assert((client.innerApiCalls.getParticipant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateParticipant', () => { + it('invokes updateParticipant without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest()); + request.participant = {}; + request.participant.name = ''; + const expectedHeaderRequestParams = "participant.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()); + client.innerApiCalls.updateParticipant = stubSimpleCall(expectedResponse); + const [response] = await client.updateParticipant(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateParticipant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateParticipant without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest()); + request.participant = {}; + request.participant.name = ''; + const expectedHeaderRequestParams = "participant.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()); + client.innerApiCalls.updateParticipant = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateParticipant( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IParticipant|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateParticipant as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateParticipant with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest()); + request.participant = {}; + request.participant.name = ''; + const expectedHeaderRequestParams = "participant.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateParticipant = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateParticipant(request), expectedError); + assert((client.innerApiCalls.updateParticipant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('analyzeContent', () => { + it('invokes analyzeContent without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest()); + request.participant = ''; + const expectedHeaderRequestParams = "participant="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnalyzeContentResponse()); + client.innerApiCalls.analyzeContent = stubSimpleCall(expectedResponse); + const [response] = await client.analyzeContent(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.analyzeContent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes analyzeContent without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest()); + request.participant = ''; + const expectedHeaderRequestParams = "participant="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnalyzeContentResponse()); + client.innerApiCalls.analyzeContent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.analyzeContent( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.analyzeContent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes analyzeContent with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest()); + request.participant = ''; + const expectedHeaderRequestParams = "participant="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeContent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.analyzeContent(request), expectedError); + assert((client.innerApiCalls.analyzeContent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('suggestArticles', () => { + it('invokes suggestArticles without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestArticlesResponse()); + client.innerApiCalls.suggestArticles = stubSimpleCall(expectedResponse); + const [response] = await client.suggestArticles(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.suggestArticles as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes suggestArticles without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestArticlesResponse()); + client.innerApiCalls.suggestArticles = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.suggestArticles( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.suggestArticles as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes suggestArticles with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.suggestArticles = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.suggestArticles(request), expectedError); + assert((client.innerApiCalls.suggestArticles as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('suggestFaqAnswers', () => { + it('invokes suggestFaqAnswers without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse()); + client.innerApiCalls.suggestFaqAnswers = stubSimpleCall(expectedResponse); + const [response] = await client.suggestFaqAnswers(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.suggestFaqAnswers as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes suggestFaqAnswers without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse()); + client.innerApiCalls.suggestFaqAnswers = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.suggestFaqAnswers( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.suggestFaqAnswers as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes suggestFaqAnswers with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.suggestFaqAnswers = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.suggestFaqAnswers(request), expectedError); + assert((client.innerApiCalls.suggestFaqAnswers as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('suggestSmartReplies', () => { + it('invokes suggestSmartReplies without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse()); + client.innerApiCalls.suggestSmartReplies = stubSimpleCall(expectedResponse); + const [response] = await client.suggestSmartReplies(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.suggestSmartReplies as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes suggestSmartReplies without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse()); + client.innerApiCalls.suggestSmartReplies = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.suggestSmartReplies( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.suggestSmartReplies as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes suggestSmartReplies with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.suggestSmartReplies = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.suggestSmartReplies(request), expectedError); + assert((client.innerApiCalls.suggestSmartReplies as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('compileSuggestion', () => { + it('invokes compileSuggestion without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CompileSuggestionResponse()); + client.innerApiCalls.compileSuggestion = stubSimpleCall(expectedResponse); + const [response] = await client.compileSuggestion(request); + assert(stub.calledOnce); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.compileSuggestion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes compileSuggestion without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CompileSuggestionResponse()); + client.innerApiCalls.compileSuggestion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.compileSuggestion( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert(stub.calledOnce); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.compileSuggestion as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes compileSuggestion with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.compileSuggestion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.compileSuggestion(request), expectedError); + assert(stub.calledOnce); + assert((client.innerApiCalls.compileSuggestion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listParticipants', () => { + it('invokes listParticipants without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), + ]; + client.innerApiCalls.listParticipants = stubSimpleCall(expectedResponse); + const [response] = await client.listParticipants(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listParticipants as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listParticipants without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), + ]; + client.innerApiCalls.listParticipants = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listParticipants( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IParticipant[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listParticipants as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listParticipants with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listParticipants = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listParticipants(request), expectedError); + assert((client.innerApiCalls.listParticipants as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listParticipantsStream without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), + ]; + client.descriptors.page.listParticipants.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listParticipantsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Participant[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Participant) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listParticipants.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listParticipants, request)); + assert.strictEqual( + (client.descriptors.page.listParticipants.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listParticipantsStream with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listParticipants.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listParticipantsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Participant[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Participant) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listParticipants.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listParticipants, request)); + assert.strictEqual( + (client.descriptors.page.listParticipants.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listParticipants without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), + ]; + client.descriptors.page.listParticipants.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IParticipant[] = []; + const iterable = client.listParticipantsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listParticipants.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listParticipants.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listParticipants with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listParticipants.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listParticipantsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IParticipant[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listParticipants.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listParticipants.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listSuggestions', () => { + it('invokes listSuggestions without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), + ]; + client.innerApiCalls.listSuggestions = stubSimpleCall(expectedResponse); + const [response] = await client.listSuggestions(request); + assert(stub.calledOnce); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSuggestions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSuggestions without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), + ]; + client.innerApiCalls.listSuggestions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSuggestions( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.ISuggestion[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert(stub.calledOnce); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSuggestions as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listSuggestions with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listSuggestions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSuggestions(request), expectedError); + assert(stub.calledOnce); + assert((client.innerApiCalls.listSuggestions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSuggestionsStream without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), + ]; + client.descriptors.page.listSuggestions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSuggestionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Suggestion[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Suggestion) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert(stub.calledOnce); + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listSuggestions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSuggestions, request)); + assert.strictEqual( + (client.descriptors.page.listSuggestions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listSuggestionsStream with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listSuggestions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSuggestionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Suggestion[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Suggestion) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert(stub.calledOnce); + assert((client.descriptors.page.listSuggestions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSuggestions, request)); + assert.strictEqual( + (client.descriptors.page.listSuggestions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSuggestions without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), + ]; + client.descriptors.page.listSuggestions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.ISuggestion[] = []; + const iterable = client.listSuggestionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert(stub.calledOnce); + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSuggestions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSuggestions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSuggestions with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listSuggestions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSuggestionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.ISuggestion[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert(stub.calledOnce); + assert.deepStrictEqual( + (client.descriptors.page.listSuggestions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSuggestions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + 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 participantsModule.v2beta1.ParticipantsClient({ + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + 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 participantsModule.v2beta1.ParticipantsClient({ + 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/owl-bot-staging/v2beta1/test/gapic_session_entity_types_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_session_entity_types_v2beta1.ts new file mode 100644 index 00000000..7979c6b0 --- /dev/null +++ b/owl-bot-staging/v2beta1/test/gapic_session_entity_types_v2beta1.ts @@ -0,0 +1,2372 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as sessionentitytypesModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2beta1.SessionEntityTypesClient', () => { + it('has servicePath', () => { + const servicePath = sessionentitytypesModule.v2beta1.SessionEntityTypesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = sessionentitytypesModule.v2beta1.SessionEntityTypesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = sessionentitytypesModule.v2beta1.SessionEntityTypesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sessionEntityTypesStub, undefined); + await client.initialize(); + assert(client.sessionEntityTypesStub); + }); + + it('has close method', () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getSessionEntityType', () => { + it('invokes getSessionEntityType without error', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()); + client.innerApiCalls.getSessionEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.getSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getSessionEntityType without error using callback', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()); + client.innerApiCalls.getSessionEntityType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSessionEntityType( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.ISessionEntityType|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getSessionEntityType with error', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getSessionEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSessionEntityType(request), expectedError); + assert((client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createSessionEntityType', () => { + it('invokes createSessionEntityType without error', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()); + client.innerApiCalls.createSessionEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.createSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createSessionEntityType without error using callback', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()); + client.innerApiCalls.createSessionEntityType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSessionEntityType( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.ISessionEntityType|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createSessionEntityType with error', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createSessionEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSessionEntityType(request), expectedError); + assert((client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateSessionEntityType', () => { + it('invokes updateSessionEntityType without error', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest()); + request.sessionEntityType = {}; + request.sessionEntityType.name = ''; + const expectedHeaderRequestParams = "session_entity_type.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()); + client.innerApiCalls.updateSessionEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.updateSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateSessionEntityType without error using callback', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest()); + request.sessionEntityType = {}; + request.sessionEntityType.name = ''; + const expectedHeaderRequestParams = "session_entity_type.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()); + client.innerApiCalls.updateSessionEntityType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSessionEntityType( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.ISessionEntityType|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateSessionEntityType with error', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest()); + request.sessionEntityType = {}; + request.sessionEntityType.name = ''; + const expectedHeaderRequestParams = "session_entity_type.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSessionEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSessionEntityType(request), expectedError); + assert((client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteSessionEntityType', () => { + it('invokes deleteSessionEntityType without error', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteSessionEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.deleteSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteSessionEntityType without error using callback', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteSessionEntityType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSessionEntityType( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteSessionEntityType with error', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSessionEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteSessionEntityType(request), expectedError); + assert((client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listSessionEntityTypes', () => { + it('invokes listSessionEntityTypes without error', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), + ]; + client.innerApiCalls.listSessionEntityTypes = stubSimpleCall(expectedResponse); + const [response] = await client.listSessionEntityTypes(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSessionEntityTypes without error using callback', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), + ]; + client.innerApiCalls.listSessionEntityTypes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSessionEntityTypes( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.ISessionEntityType[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listSessionEntityTypes with error', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listSessionEntityTypes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSessionEntityTypes(request), expectedError); + assert((client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSessionEntityTypesStream without error', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), + ]; + client.descriptors.page.listSessionEntityTypes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSessionEntityTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.SessionEntityType[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.SessionEntityType) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSessionEntityTypes, request)); + assert.strictEqual( + (client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listSessionEntityTypesStream with error', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listSessionEntityTypes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSessionEntityTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.SessionEntityType[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.SessionEntityType) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSessionEntityTypes, request)); + assert.strictEqual( + (client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSessionEntityTypes without error', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), + ]; + client.descriptors.page.listSessionEntityTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.ISessionEntityType[] = []; + const iterable = client.listSessionEntityTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSessionEntityTypes with error', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listSessionEntityTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSessionEntityTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.ISessionEntityType[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSession', () => { + const fakePath = "/rendered/path/projectAgentSession"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionPath', () => { + const result = client.projectAgentSessionPath("projectValue", "sessionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionName', () => { + const result = client.matchProjectFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionName', () => { + const result = client.matchSessionFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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/owl-bot-staging/v2beta1/test/gapic_sessions_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_sessions_v2beta1.ts new file mode 100644 index 00000000..182ce86c --- /dev/null +++ b/owl-bot-staging/v2beta1/test/gapic_sessions_v2beta1.ts @@ -0,0 +1,2046 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as sessionsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubBidiStreamingCall(response?: ResponseType, error?: Error) { + const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + return sinon.stub().returns(mockStream); +} + +describe('v2beta1.SessionsClient', () => { + it('has servicePath', () => { + const servicePath = sessionsModule.v2beta1.SessionsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = sessionsModule.v2beta1.SessionsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = sessionsModule.v2beta1.SessionsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sessionsModule.v2beta1.SessionsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sessionsStub, undefined); + await client.initialize(); + assert(client.sessionsStub); + }); + + it('has close method', () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('detectIntent', () => { + it('invokes detectIntent without error', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DetectIntentRequest()); + request.session = ''; + const expectedHeaderRequestParams = "session="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DetectIntentResponse()); + client.innerApiCalls.detectIntent = stubSimpleCall(expectedResponse); + const [response] = await client.detectIntent(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.detectIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes detectIntent without error using callback', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DetectIntentRequest()); + request.session = ''; + const expectedHeaderRequestParams = "session="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DetectIntentResponse()); + client.innerApiCalls.detectIntent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.detectIntent( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.detectIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes detectIntent with error', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DetectIntentRequest()); + request.session = ''; + const expectedHeaderRequestParams = "session="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.detectIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.detectIntent(request), expectedError); + assert((client.innerApiCalls.detectIntent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('streamingDetectIntent', () => { + it('invokes streamingDetectIntent without error', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest()); + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse()); + client.innerApiCalls.streamingDetectIntent = stubBidiStreamingCall(expectedResponse); + const stream = client.streamingDetectIntent(); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.streamingDetectIntent as SinonStub) + .getCall(0).calledWithExactly(undefined)); + assert.deepStrictEqual(((stream as unknown as PassThrough) + ._transform as SinonStub).getCall(0).args[0], request); + }); + + it('invokes streamingDetectIntent with error', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest());const expectedError = new Error('expected'); + client.innerApiCalls.streamingDetectIntent = stubBidiStreamingCall(undefined, expectedError); + const stream = client.streamingDetectIntent(); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert((client.innerApiCalls.streamingDetectIntent as SinonStub) + .getCall(0).calledWithExactly(undefined)); + assert.deepStrictEqual(((stream as unknown as PassThrough) + ._transform as SinonStub).getCall(0).args[0], request); + }); + }); + + describe('Path templates', () => { + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSession', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSession"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionPath', () => { + const result = client.projectAgentEnvironmentUserSessionPath("projectValue", "environmentValue", "userValue", "sessionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSession', () => { + const fakePath = "/rendered/path/projectAgentSession"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionPath', () => { + const result = client.projectAgentSessionPath("projectValue", "sessionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionName', () => { + const result = client.matchProjectFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionName', () => { + const result = client.matchSessionFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSession', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSession"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSession', () => { + const fakePath = "/rendered/path/projectLocationAgentSession"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionPath', () => { + const result = client.projectLocationAgentSessionPath("projectValue", "locationValue", "sessionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v2beta1/test/gapic_versions_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_versions_v2beta1.ts new file mode 100644 index 00000000..014c6027 --- /dev/null +++ b/owl-bot-staging/v2beta1/test/gapic_versions_v2beta1.ts @@ -0,0 +1,2334 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as versionsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2beta1.VersionsClient', () => { + it('has servicePath', () => { + const servicePath = versionsModule.v2beta1.VersionsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = versionsModule.v2beta1.VersionsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = versionsModule.v2beta1.VersionsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new versionsModule.v2beta1.VersionsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new versionsModule.v2beta1.VersionsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.versionsStub, undefined); + await client.initialize(); + assert(client.versionsStub); + }); + + it('has close method', () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getVersion', () => { + it('invokes getVersion without error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()); + client.innerApiCalls.getVersion = stubSimpleCall(expectedResponse); + const [response] = await client.getVersion(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getVersion without error using callback', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()); + client.innerApiCalls.getVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getVersion( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getVersion with error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getVersion(request), expectedError); + assert((client.innerApiCalls.getVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createVersion', () => { + it('invokes createVersion without error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateVersionRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()); + client.innerApiCalls.createVersion = stubSimpleCall(expectedResponse); + const [response] = await client.createVersion(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createVersion without error using callback', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateVersionRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()); + client.innerApiCalls.createVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createVersion( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createVersion with error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateVersionRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createVersion(request), expectedError); + assert((client.innerApiCalls.createVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateVersion', () => { + it('invokes updateVersion without error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateVersionRequest()); + request.version = {}; + request.version.name = ''; + const expectedHeaderRequestParams = "version.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()); + client.innerApiCalls.updateVersion = stubSimpleCall(expectedResponse); + const [response] = await client.updateVersion(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateVersion without error using callback', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateVersionRequest()); + request.version = {}; + request.version.name = ''; + const expectedHeaderRequestParams = "version.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()); + client.innerApiCalls.updateVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateVersion( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateVersion with error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateVersionRequest()); + request.version = {}; + request.version.name = ''; + const expectedHeaderRequestParams = "version.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateVersion(request), expectedError); + assert((client.innerApiCalls.updateVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteVersion', () => { + it('invokes deleteVersion without error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteVersion = stubSimpleCall(expectedResponse); + const [response] = await client.deleteVersion(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteVersion without error using callback', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteVersion( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteVersion with error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteVersion(request), expectedError); + assert((client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listVersions', () => { + it('invokes listVersions without error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), + ]; + client.innerApiCalls.listVersions = stubSimpleCall(expectedResponse); + const [response] = await client.listVersions(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listVersions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listVersions without error using callback', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), + ]; + client.innerApiCalls.listVersions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listVersions( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IVersion[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listVersions as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listVersions with error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listVersions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listVersions(request), expectedError); + assert((client.innerApiCalls.listVersions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listVersionsStream without error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), + ]; + client.descriptors.page.listVersions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Version[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Version) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listVersions, request)); + assert.strictEqual( + (client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listVersionsStream with error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listVersions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Version[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Version) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listVersions, request)); + assert.strictEqual( + (client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listVersions without error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), + ]; + client.descriptors.page.listVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IVersion[] = []; + const iterable = client.listVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listVersions with error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IVersion[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgent', () => { + const fakePath = "/rendered/path/projectAgent"; + const expectedParameters = { + project: "projectValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = "/rendered/path/projectAgentEntityType"; + const expectedParameters = { + project: "projectValue", + entity_type: "entityTypeValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = "/rendered/path/projectAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = "/rendered/path/projectAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = "/rendered/path/projectAgentIntent"; + const expectedParameters = { + project: "projectValue", + intent: "intentValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath("projectValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = "/rendered/path/projectAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = "/rendered/path/projectAgentVersion"; + const expectedParameters = { + project: "projectValue", + version: "versionValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath("projectValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = "/rendered/path/projectAnswerRecord"; + const expectedParameters = { + project: "projectValue", + answer_record: "answerRecordValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversation', () => { + const fakePath = "/rendered/path/projectConversation"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath("projectValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = "/rendered/path/projectConversationMessage"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = "/rendered/path/projectConversationParticipant"; + const expectedParameters = { + project: "projectValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = client.matchConversationFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = "/rendered/path/projectConversationProfile"; + const expectedParameters = { + project: "projectValue", + conversation_profile: "conversationProfileValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = "/rendered/path/projectKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + 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 versionsModule.v2beta1.VersionsClient({ + 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 = { + project: "projectValue", + location: "locationValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + entity_type: "entityTypeValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + environment: "environmentValue", + user: "userValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "environmentValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = "/rendered/path/projectLocationAgentFulfillment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = "/rendered/path/projectLocationAgentIntent"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + intent: "intentValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, "intentValue"); + assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionContext"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + context: "contextValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); + assert.strictEqual(result, "contextValue"); + assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + session: "sessionValue", + entity_type: "entityTypeValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, "entityTypeValue"); + assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = "/rendered/path/projectLocationAgentVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + version: "versionValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = "/rendered/path/projectLocationAnswerRecord"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + answer_record: "answerRecordValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, "answerRecordValue"); + assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = "/rendered/path/projectLocationConversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = "/rendered/path/projectLocationConversationMessage"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + message: "messageValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); + assert.strictEqual(result, "messageValue"); + assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = "/rendered/path/projectLocationConversationParticipant"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + participant: "participantValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); + assert.strictEqual(result, "participantValue"); + assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = "/rendered/path/projectLocationConversationProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_profile: "conversationProfileValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); + assert.strictEqual(result, "conversationProfileValue"); + assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = "/rendered/path/projectLocationKnowledgeBase"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + knowledge_base: "knowledgeBaseValue", + }; + const client = new versionsModule.v2beta1.VersionsClient({ + 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 versionsModule.v2beta1.VersionsClient({ + 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/owl-bot-staging/v2beta1/tsconfig.json b/owl-bot-staging/v2beta1/tsconfig.json new file mode 100644 index 00000000..c78f1c88 --- /dev/null +++ b/owl-bot-staging/v2beta1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v2beta1/webpack.config.js b/owl-bot-staging/v2beta1/webpack.config.js new file mode 100644 index 00000000..0d2fc635 --- /dev/null +++ b/owl-bot-staging/v2beta1/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'dialogflow', + filename: './dialogflow.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; From 2613faf85991334f9a263643c99d159e45166b73 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 4 Aug 2021 19:06:08 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md --- owl-bot-staging/v2/.eslintignore | 6 - owl-bot-staging/v2/.eslintrc.json | 3 - owl-bot-staging/v2/.gitignore | 14 - owl-bot-staging/v2/.jsdoc.js | 55 - owl-bot-staging/v2/.mocharc.js | 33 - owl-bot-staging/v2/.prettierrc.js | 22 - owl-bot-staging/v2/README.md | 1 - owl-bot-staging/v2/linkinator.config.json | 10 - owl-bot-staging/v2/package.json | 78 - .../google/cloud/dialogflow/v2/agent.proto | 506 --- .../cloud/dialogflow/v2/answer_record.proto | 292 -- .../cloud/dialogflow/v2/audio_config.proto | 372 -- .../google/cloud/dialogflow/v2/context.proto | 331 -- .../cloud/dialogflow/v2/conversation.proto | 358 -- .../dialogflow/v2/conversation_event.proto | 86 - .../dialogflow/v2/conversation_profile.proto | 594 --- .../google/cloud/dialogflow/v2/document.proto | 410 --- .../cloud/dialogflow/v2/entity_type.proto | 569 --- .../cloud/dialogflow/v2/environment.proto | 390 -- .../cloud/dialogflow/v2/fulfillment.proto | 174 - .../google/cloud/dialogflow/v2/gcs.proto | 28 - .../v2/human_agent_assistant_event.proto | 44 - .../google/cloud/dialogflow/v2/intent.proto | 1097 ------ .../cloud/dialogflow/v2/knowledge_base.proto | 234 -- .../cloud/dialogflow/v2/participant.proto | 611 ---- .../google/cloud/dialogflow/v2/session.proto | 672 ---- .../dialogflow/v2/session_entity_type.proto | 313 -- .../dialogflow/v2/validation_result.proto | 76 - .../google/cloud/dialogflow/v2/version.proto | 267 -- .../google/cloud/dialogflow/v2/webhook.proto | 145 - owl-bot-staging/v2/src/index.ts | 53 - owl-bot-staging/v2/src/v2/agents_client.ts | 3085 ---------------- .../v2/src/v2/agents_client_config.json | 74 - .../v2/src/v2/agents_proto_list.json | 23 - .../v2/src/v2/answer_records_client.ts | 2408 ------------ .../src/v2/answer_records_client_config.json | 39 - .../v2/src/v2/answer_records_proto_list.json | 23 - owl-bot-staging/v2/src/v2/contexts_client.ts | 2730 -------------- .../v2/src/v2/contexts_client_config.json | 59 - .../v2/src/v2/contexts_proto_list.json | 23 - .../v2/src/v2/conversation_profiles_client.ts | 2599 ------------- .../conversation_profiles_client_config.json | 54 - .../v2/conversation_profiles_proto_list.json | 23 - .../v2/src/v2/conversations_client.ts | 2818 -------------- .../src/v2/conversations_client_config.json | 54 - .../v2/src/v2/conversations_proto_list.json | 23 - owl-bot-staging/v2/src/v2/documents_client.ts | 2838 -------------- .../v2/src/v2/documents_client_config.json | 59 - .../v2/src/v2/documents_proto_list.json | 23 - .../v2/src/v2/entity_types_client.ts | 3242 ---------------- .../v2/src/v2/entity_types_client_config.json | 79 - .../v2/src/v2/entity_types_proto_list.json | 23 - .../v2/src/v2/environments_client.ts | 2832 -------------- .../v2/src/v2/environments_client_config.json | 59 - .../v2/src/v2/environments_proto_list.json | 23 - .../v2/src/v2/fulfillments_client.ts | 2226 ----------- .../v2/src/v2/fulfillments_client_config.json | 39 - .../v2/src/v2/fulfillments_proto_list.json | 23 - owl-bot-staging/v2/src/v2/gapic_metadata.json | 1094 ------ owl-bot-staging/v2/src/v2/index.ts | 33 - owl-bot-staging/v2/src/v2/intents_client.ts | 2927 --------------- .../v2/src/v2/intents_client_config.json | 64 - .../v2/src/v2/intents_proto_list.json | 23 - .../v2/src/v2/knowledge_bases_client.ts | 2596 ------------- .../src/v2/knowledge_bases_client_config.json | 54 - .../v2/src/v2/knowledge_bases_proto_list.json | 23 - .../v2/src/v2/participants_client.ts | 2784 -------------- .../v2/src/v2/participants_client_config.json | 64 - .../v2/src/v2/participants_proto_list.json | 23 - .../v2/src/v2/session_entity_types_client.ts | 2677 -------------- .../session_entity_types_client_config.json | 54 - .../v2/session_entity_types_proto_list.json | 23 - owl-bot-staging/v2/src/v2/sessions_client.ts | 2476 ------------- .../v2/src/v2/sessions_client_config.json | 39 - .../v2/src/v2/sessions_proto_list.json | 23 - owl-bot-staging/v2/src/v2/versions_client.ts | 2620 ------------- .../v2/src/v2/versions_client_config.json | 54 - .../v2/src/v2/versions_proto_list.json | 23 - .../system-test/fixtures/sample/src/index.js | 41 - .../system-test/fixtures/sample/src/index.ts | 116 - owl-bot-staging/v2/system-test/install.ts | 49 - owl-bot-staging/v2/test/gapic_agents_v2.ts | 2926 --------------- .../v2/test/gapic_answer_records_v2.ts | 2082 ----------- owl-bot-staging/v2/test/gapic_contexts_v2.ts | 2456 ------------- .../v2/test/gapic_conversation_profiles_v2.ts | 2334 ------------ .../v2/test/gapic_conversations_v2.ts | 2470 ------------- owl-bot-staging/v2/test/gapic_documents_v2.ts | 2675 -------------- .../v2/test/gapic_entity_types_v2.ts | 3070 ---------------- .../v2/test/gapic_environments_v2.ts | 2557 ------------- .../v2/test/gapic_fulfillments_v2.ts | 1866 ---------- owl-bot-staging/v2/test/gapic_intents_v2.ts | 2638 -------------- .../v2/test/gapic_knowledge_bases_v2.ts | 2334 ------------ .../v2/test/gapic_participants_v2.ts | 2502 ------------- .../v2/test/gapic_session_entity_types_v2.ts | 2372 ------------ owl-bot-staging/v2/test/gapic_sessions_v2.ts | 2046 ----------- owl-bot-staging/v2/test/gapic_versions_v2.ts | 2334 ------------ owl-bot-staging/v2/tsconfig.json | 19 - owl-bot-staging/v2/webpack.config.js | 64 - owl-bot-staging/v2beta1/.eslintignore | 6 - owl-bot-staging/v2beta1/.eslintrc.json | 3 - owl-bot-staging/v2beta1/.gitignore | 14 - owl-bot-staging/v2beta1/.jsdoc.js | 55 - owl-bot-staging/v2beta1/.mocharc.js | 33 - owl-bot-staging/v2beta1/.prettierrc.js | 22 - owl-bot-staging/v2beta1/README.md | 1 - .../v2beta1/linkinator.config.json | 10 - owl-bot-staging/v2beta1/package.json | 78 - .../cloud/dialogflow/v2beta1/agent.proto | 519 --- .../dialogflow/v2beta1/answer_record.proto | 317 -- .../dialogflow/v2beta1/audio_config.proto | 437 --- .../cloud/dialogflow/v2beta1/context.proto | 375 -- .../dialogflow/v2beta1/conversation.proto | 419 --- .../v2beta1/conversation_event.proto | 82 - .../v2beta1/conversation_profile.proto | 581 --- .../cloud/dialogflow/v2beta1/document.proto | 533 --- .../dialogflow/v2beta1/entity_type.proto | 571 --- .../dialogflow/v2beta1/environment.proto | 367 -- .../dialogflow/v2beta1/fulfillment.proto | 176 - .../google/cloud/dialogflow/v2beta1/gcs.proto | 46 - .../v2beta1/human_agent_assistant_event.proto | 51 - .../cloud/dialogflow/v2beta1/intent.proto | 1422 -------- .../dialogflow/v2beta1/knowledge_base.proto | 278 -- .../dialogflow/v2beta1/participant.proto | 1062 ------ .../cloud/dialogflow/v2beta1/session.proto | 812 ----- .../v2beta1/session_entity_type.proto | 351 -- .../v2beta1/validation_result.proto | 76 - .../cloud/dialogflow/v2beta1/version.proto | 261 -- .../cloud/dialogflow/v2beta1/webhook.proto | 165 - owl-bot-staging/v2beta1/src/index.ts | 53 - .../v2beta1/src/v2beta1/agents_client.ts | 3088 ---------------- .../src/v2beta1/agents_client_config.json | 74 - .../src/v2beta1/agents_proto_list.json | 23 - .../src/v2beta1/answer_records_client.ts | 2463 ------------- .../v2beta1/answer_records_client_config.json | 44 - .../v2beta1/answer_records_proto_list.json | 23 - .../v2beta1/src/v2beta1/contexts_client.ts | 2781 -------------- .../src/v2beta1/contexts_client_config.json | 59 - .../src/v2beta1/contexts_proto_list.json | 23 - .../v2beta1/conversation_profiles_client.ts | 2599 ------------- .../conversation_profiles_client_config.json | 54 - .../conversation_profiles_proto_list.json | 23 - .../src/v2beta1/conversations_client.ts | 2896 --------------- .../v2beta1/conversations_client_config.json | 59 - .../src/v2beta1/conversations_proto_list.json | 23 - .../v2beta1/src/v2beta1/documents_client.ts | 3032 --------------- .../src/v2beta1/documents_client_config.json | 64 - .../src/v2beta1/documents_proto_list.json | 23 - .../src/v2beta1/entity_types_client.ts | 3244 ----------------- .../v2beta1/entity_types_client_config.json | 79 - .../src/v2beta1/entity_types_proto_list.json | 23 - .../src/v2beta1/environments_client.ts | 2813 -------------- .../v2beta1/environments_client_config.json | 59 - .../src/v2beta1/environments_proto_list.json | 23 - .../src/v2beta1/fulfillments_client.ts | 2228 ----------- .../v2beta1/fulfillments_client_config.json | 39 - .../src/v2beta1/fulfillments_proto_list.json | 23 - .../v2beta1/src/v2beta1/gapic_metadata.json | 1158 ------ owl-bot-staging/v2beta1/src/v2beta1/index.ts | 33 - .../v2beta1/src/v2beta1/intents_client.ts | 2925 --------------- .../src/v2beta1/intents_client_config.json | 64 - .../src/v2beta1/intents_proto_list.json | 23 - .../src/v2beta1/knowledge_bases_client.ts | 2692 -------------- .../knowledge_bases_client_config.json | 54 - .../v2beta1/knowledge_bases_proto_list.json | 23 - .../src/v2beta1/participants_client.ts | 3221 ---------------- .../v2beta1/participants_client_config.json | 79 - .../src/v2beta1/participants_proto_list.json | 23 - .../v2beta1/session_entity_types_client.ts | 2724 -------------- .../session_entity_types_client_config.json | 54 - .../session_entity_types_proto_list.json | 23 - .../v2beta1/src/v2beta1/sessions_client.ts | 2482 ------------- .../src/v2beta1/sessions_client_config.json | 39 - .../src/v2beta1/sessions_proto_list.json | 23 - .../v2beta1/src/v2beta1/versions_client.ts | 2613 ------------- .../src/v2beta1/versions_client_config.json | 54 - .../src/v2beta1/versions_proto_list.json | 23 - .../system-test/fixtures/sample/src/index.js | 41 - .../system-test/fixtures/sample/src/index.ts | 116 - .../v2beta1/system-test/install.ts | 49 - .../v2beta1/test/gapic_agents_v2beta1.ts | 2926 --------------- .../test/gapic_answer_records_v2beta1.ts | 2172 ----------- .../v2beta1/test/gapic_contexts_v2beta1.ts | 2456 ------------- .../gapic_conversation_profiles_v2beta1.ts | 2334 ------------ .../test/gapic_conversations_v2beta1.ts | 2554 ------------- .../v2beta1/test/gapic_documents_v2beta1.ts | 2819 -------------- .../test/gapic_entity_types_v2beta1.ts | 3070 ---------------- .../test/gapic_environments_v2beta1.ts | 2557 ------------- .../test/gapic_fulfillments_v2beta1.ts | 1866 ---------- .../v2beta1/test/gapic_intents_v2beta1.ts | 2638 -------------- .../test/gapic_knowledge_bases_v2beta1.ts | 2334 ------------ .../test/gapic_participants_v2beta1.ts | 2913 --------------- .../gapic_session_entity_types_v2beta1.ts | 2372 ------------ .../v2beta1/test/gapic_sessions_v2beta1.ts | 2046 ----------- .../v2beta1/test/gapic_versions_v2beta1.ts | 2334 ------------ owl-bot-staging/v2beta1/tsconfig.json | 19 - owl-bot-staging/v2beta1/webpack.config.js | 64 - .../cloud/dialogflow/v2/audio_config.proto | 60 +- .../cloud/dialogflow/v2/environment.proto | 38 +- .../google/cloud/dialogflow/v2/session.proto | 3 + .../google/cloud/dialogflow/v2/version.proto | 6 + protos/protos.d.ts | 30 +- protos/protos.js | 74 +- protos/protos.json | 28 +- src/v2/environments_client.ts | 37 +- src/v2/versions_client.ts | 7 + 205 files changed, 184 insertions(+), 179137 deletions(-) delete mode 100644 owl-bot-staging/v2/.eslintignore delete mode 100644 owl-bot-staging/v2/.eslintrc.json delete mode 100644 owl-bot-staging/v2/.gitignore delete mode 100644 owl-bot-staging/v2/.jsdoc.js delete mode 100644 owl-bot-staging/v2/.mocharc.js delete mode 100644 owl-bot-staging/v2/.prettierrc.js delete mode 100644 owl-bot-staging/v2/README.md delete mode 100644 owl-bot-staging/v2/linkinator.config.json delete mode 100644 owl-bot-staging/v2/package.json delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/agent.proto delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/answer_record.proto delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/audio_config.proto delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/context.proto delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation.proto delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation_event.proto delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation_profile.proto delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/document.proto delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/entity_type.proto delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/environment.proto delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/fulfillment.proto delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/gcs.proto delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/intent.proto delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/knowledge_base.proto delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/participant.proto delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/session.proto delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/session_entity_type.proto delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/validation_result.proto delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/version.proto delete mode 100644 owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/webhook.proto delete mode 100644 owl-bot-staging/v2/src/index.ts delete mode 100644 owl-bot-staging/v2/src/v2/agents_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/agents_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/agents_proto_list.json delete mode 100644 owl-bot-staging/v2/src/v2/answer_records_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/answer_records_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/answer_records_proto_list.json delete mode 100644 owl-bot-staging/v2/src/v2/contexts_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/contexts_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/contexts_proto_list.json delete mode 100644 owl-bot-staging/v2/src/v2/conversation_profiles_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/conversation_profiles_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/conversation_profiles_proto_list.json delete mode 100644 owl-bot-staging/v2/src/v2/conversations_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/conversations_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/conversations_proto_list.json delete mode 100644 owl-bot-staging/v2/src/v2/documents_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/documents_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/documents_proto_list.json delete mode 100644 owl-bot-staging/v2/src/v2/entity_types_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/entity_types_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/entity_types_proto_list.json delete mode 100644 owl-bot-staging/v2/src/v2/environments_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/environments_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/environments_proto_list.json delete mode 100644 owl-bot-staging/v2/src/v2/fulfillments_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/fulfillments_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/fulfillments_proto_list.json delete mode 100644 owl-bot-staging/v2/src/v2/gapic_metadata.json delete mode 100644 owl-bot-staging/v2/src/v2/index.ts delete mode 100644 owl-bot-staging/v2/src/v2/intents_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/intents_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/intents_proto_list.json delete mode 100644 owl-bot-staging/v2/src/v2/knowledge_bases_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/knowledge_bases_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/knowledge_bases_proto_list.json delete mode 100644 owl-bot-staging/v2/src/v2/participants_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/participants_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/participants_proto_list.json delete mode 100644 owl-bot-staging/v2/src/v2/session_entity_types_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/session_entity_types_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/session_entity_types_proto_list.json delete mode 100644 owl-bot-staging/v2/src/v2/sessions_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/sessions_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/sessions_proto_list.json delete mode 100644 owl-bot-staging/v2/src/v2/versions_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/versions_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/versions_proto_list.json delete mode 100644 owl-bot-staging/v2/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v2/system-test/install.ts delete mode 100644 owl-bot-staging/v2/test/gapic_agents_v2.ts delete mode 100644 owl-bot-staging/v2/test/gapic_answer_records_v2.ts delete mode 100644 owl-bot-staging/v2/test/gapic_contexts_v2.ts delete mode 100644 owl-bot-staging/v2/test/gapic_conversation_profiles_v2.ts delete mode 100644 owl-bot-staging/v2/test/gapic_conversations_v2.ts delete mode 100644 owl-bot-staging/v2/test/gapic_documents_v2.ts delete mode 100644 owl-bot-staging/v2/test/gapic_entity_types_v2.ts delete mode 100644 owl-bot-staging/v2/test/gapic_environments_v2.ts delete mode 100644 owl-bot-staging/v2/test/gapic_fulfillments_v2.ts delete mode 100644 owl-bot-staging/v2/test/gapic_intents_v2.ts delete mode 100644 owl-bot-staging/v2/test/gapic_knowledge_bases_v2.ts delete mode 100644 owl-bot-staging/v2/test/gapic_participants_v2.ts delete mode 100644 owl-bot-staging/v2/test/gapic_session_entity_types_v2.ts delete mode 100644 owl-bot-staging/v2/test/gapic_sessions_v2.ts delete mode 100644 owl-bot-staging/v2/test/gapic_versions_v2.ts delete mode 100644 owl-bot-staging/v2/tsconfig.json delete mode 100644 owl-bot-staging/v2/webpack.config.js delete mode 100644 owl-bot-staging/v2beta1/.eslintignore delete mode 100644 owl-bot-staging/v2beta1/.eslintrc.json delete mode 100644 owl-bot-staging/v2beta1/.gitignore delete mode 100644 owl-bot-staging/v2beta1/.jsdoc.js delete mode 100644 owl-bot-staging/v2beta1/.mocharc.js delete mode 100644 owl-bot-staging/v2beta1/.prettierrc.js delete mode 100644 owl-bot-staging/v2beta1/README.md delete mode 100644 owl-bot-staging/v2beta1/linkinator.config.json delete mode 100644 owl-bot-staging/v2beta1/package.json delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/agent.proto delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/answer_record.proto delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/audio_config.proto delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/context.proto delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation.proto delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_event.proto delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/document.proto delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/entity_type.proto delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/environment.proto delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/fulfillment.proto delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/gcs.proto delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/intent.proto delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/participant.proto delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/session.proto delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/validation_result.proto delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/version.proto delete mode 100644 owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/webhook.proto delete mode 100644 owl-bot-staging/v2beta1/src/index.ts delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/agents_client.ts delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/agents_client_config.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/agents_proto_list.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/answer_records_client.ts delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/answer_records_client_config.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/answer_records_proto_list.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/contexts_client.ts delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/contexts_client_config.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/contexts_proto_list.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_client.ts delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_client_config.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_proto_list.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/conversations_client.ts delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/conversations_client_config.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/conversations_proto_list.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/documents_client.ts delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/documents_client_config.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/documents_proto_list.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/entity_types_client.ts delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/entity_types_client_config.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/entity_types_proto_list.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/environments_client.ts delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/environments_client_config.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/environments_proto_list.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/fulfillments_client.ts delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/fulfillments_client_config.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/fulfillments_proto_list.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/index.ts delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/intents_client.ts delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/intents_client_config.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/intents_proto_list.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_client.ts delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_client_config.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_proto_list.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/participants_client.ts delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/participants_client_config.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/participants_proto_list.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_client.ts delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_client_config.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_proto_list.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/sessions_client.ts delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/sessions_client_config.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/sessions_proto_list.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/versions_client.ts delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/versions_client_config.json delete mode 100644 owl-bot-staging/v2beta1/src/v2beta1/versions_proto_list.json delete mode 100644 owl-bot-staging/v2beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v2beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v2beta1/system-test/install.ts delete mode 100644 owl-bot-staging/v2beta1/test/gapic_agents_v2beta1.ts delete mode 100644 owl-bot-staging/v2beta1/test/gapic_answer_records_v2beta1.ts delete mode 100644 owl-bot-staging/v2beta1/test/gapic_contexts_v2beta1.ts delete mode 100644 owl-bot-staging/v2beta1/test/gapic_conversation_profiles_v2beta1.ts delete mode 100644 owl-bot-staging/v2beta1/test/gapic_conversations_v2beta1.ts delete mode 100644 owl-bot-staging/v2beta1/test/gapic_documents_v2beta1.ts delete mode 100644 owl-bot-staging/v2beta1/test/gapic_entity_types_v2beta1.ts delete mode 100644 owl-bot-staging/v2beta1/test/gapic_environments_v2beta1.ts delete mode 100644 owl-bot-staging/v2beta1/test/gapic_fulfillments_v2beta1.ts delete mode 100644 owl-bot-staging/v2beta1/test/gapic_intents_v2beta1.ts delete mode 100644 owl-bot-staging/v2beta1/test/gapic_knowledge_bases_v2beta1.ts delete mode 100644 owl-bot-staging/v2beta1/test/gapic_participants_v2beta1.ts delete mode 100644 owl-bot-staging/v2beta1/test/gapic_session_entity_types_v2beta1.ts delete mode 100644 owl-bot-staging/v2beta1/test/gapic_sessions_v2beta1.ts delete mode 100644 owl-bot-staging/v2beta1/test/gapic_versions_v2beta1.ts delete mode 100644 owl-bot-staging/v2beta1/tsconfig.json delete mode 100644 owl-bot-staging/v2beta1/webpack.config.js diff --git a/owl-bot-staging/v2/.eslintignore b/owl-bot-staging/v2/.eslintignore deleted file mode 100644 index 521dc25a..00000000 --- a/owl-bot-staging/v2/.eslintignore +++ /dev/null @@ -1,6 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ diff --git a/owl-bot-staging/v2/.eslintrc.json b/owl-bot-staging/v2/.eslintrc.json deleted file mode 100644 index 78215349..00000000 --- a/owl-bot-staging/v2/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v2/.gitignore b/owl-bot-staging/v2/.gitignore deleted file mode 100644 index 5d32b237..00000000 --- a/owl-bot-staging/v2/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/v2/.jsdoc.js b/owl-bot-staging/v2/.jsdoc.js deleted file mode 100644 index 01541b4a..00000000 --- a/owl-bot-staging/v2/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2021 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/dialogflow', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v2/.mocharc.js b/owl-bot-staging/v2/.mocharc.js deleted file mode 100644 index 50bc7f79..00000000 --- a/owl-bot-staging/v2/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v2/.prettierrc.js b/owl-bot-staging/v2/.prettierrc.js deleted file mode 100644 index 84f4713a..00000000 --- a/owl-bot-staging/v2/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v2/README.md b/owl-bot-staging/v2/README.md deleted file mode 100644 index f592662a..00000000 --- a/owl-bot-staging/v2/README.md +++ /dev/null @@ -1 +0,0 @@ -Dialogflow: Nodejs Client diff --git a/owl-bot-staging/v2/linkinator.config.json b/owl-bot-staging/v2/linkinator.config.json deleted file mode 100644 index 29a223b6..00000000 --- a/owl-bot-staging/v2/linkinator.config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io" - ], - "silent": true, - "concurrency": 10 -} diff --git a/owl-bot-staging/v2/package.json b/owl-bot-staging/v2/package.json deleted file mode 100644 index 050cef0d..00000000 --- a/owl-bot-staging/v2/package.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "name": "@google-cloud/dialogflow", - "version": "0.1.0", - "description": "Dialogflow client for Node.js", - "repository": "googleapis/nodejs-dialogflow", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google dialogflow", - "dialogflow", - "agents", - "answer records", - "contexts", - "conversation profiles", - "conversations", - "documents", - "entity types", - "environments", - "fulfillments", - "intents", - "knowledge bases", - "participants", - "session entity types", - "sessions", - "versions" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^2.19.0" - }, - "devDependencies": { - "@types/mocha": "^9.0.0", - "@types/node": "^14.17.3", - "@types/sinon": "^10.0.2", - "c8": "^7.7.3", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.0", - "jsdoc-region-tag": "^1.1.0", - "linkinator": "^2.13.6", - "mocha": "^9.0.2", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^11.1.1", - "ts-loader": "^9.2.3", - "typescript": "^4.3.4", - "webpack": "^5.39.1", - "webpack-cli": "^4.7.2" - }, - "engines": { - "node": ">=v10.24.0" - } -} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/agent.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/agent.proto deleted file mode 100644 index db1af7ab..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/agent.proto +++ /dev/null @@ -1,506 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dialogflow/v2/validation_result.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "AgentProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; - -// Service for managing [Agents][google.cloud.dialogflow.v2.Agent]. -service Agents { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Retrieves the specified agent. - rpc GetAgent(GetAgentRequest) returns (Agent) { - option (google.api.http) = { - get: "/v2/{parent=projects/*}/agent" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*}/agent" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Creates/updates the specified agent. - // - // Note: You should always train an agent prior to sending it queries. See the - // [training - // documentation](https://cloud.google.com/dialogflow/es/docs/training). - rpc SetAgent(SetAgentRequest) returns (Agent) { - option (google.api.http) = { - post: "/v2/{agent.parent=projects/*}/agent" - body: "agent" - additional_bindings { - post: "/v2/{agent.parent=projects/*/locations/*}/agent" - body: "agent" - } - }; - option (google.api.method_signature) = "agent"; - } - - // Deletes the specified agent. - rpc DeleteAgent(DeleteAgentRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{parent=projects/*}/agent" - additional_bindings { - delete: "/v2/{parent=projects/*/locations/*}/agent" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Returns the list of agents. - // - // Since there is at most one conversational agent per project, this method is - // useful primarily for listing all agents across projects the caller has - // access to. One can achieve that with a wildcard project collection id "-". - // Refer to [List - // Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). - rpc SearchAgents(SearchAgentsRequest) returns (SearchAgentsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*}/agent:search" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*}/agent:search" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Trains the specified agent. - // - // - // Note: You should always train an agent prior to sending it queries. See the - // [training - // documentation](https://cloud.google.com/dialogflow/es/docs/training). - rpc TrainAgent(TrainAgentRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/agent:train" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/agent:train" - body: "*" - } - }; - option (google.api.method_signature) = "parent"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Struct" - }; - } - - // Exports the specified agent to a ZIP file. - rpc ExportAgent(ExportAgentRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/agent:export" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/agent:export" - body: "*" - } - }; - option (google.api.method_signature) = "parent"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.dialogflow.v2.ExportAgentResponse" - metadata_type: "google.protobuf.Struct" - }; - } - - // Imports the specified agent from a ZIP file. - // - // Uploads new intents and entity types without deleting the existing ones. - // Intents and entity types with the same name are replaced with the new - // versions from [ImportAgentRequest][google.cloud.dialogflow.v2.ImportAgentRequest]. After the import, the imported draft - // agent will be trained automatically (unless disabled in agent settings). - // However, once the import is done, training may not be completed yet. Please - // call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the operation it returns in order to train - // explicitly. - // - // An operation which tracks when importing is complete. It only tracks - // when the draft agent is updated not when it is done training. - // - // Note: You should always train an agent prior to sending it queries. See the - // [training - // documentation](https://cloud.google.com/dialogflow/es/docs/training). - rpc ImportAgent(ImportAgentRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/agent:import" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/agent:import" - body: "*" - } - }; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Struct" - }; - } - - // Restores the specified agent from a ZIP file. - // - // Replaces the current agent version with a new one. All the intents and - // entity types in the older version are deleted. After the restore, the - // restored draft agent will be trained automatically (unless disabled in - // agent settings). However, once the restore is done, training may not be - // completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the operation it - // returns in order to train explicitly. - // - // An operation which tracks when restoring is complete. It only tracks - // when the draft agent is updated not when it is done training. - // - // Note: You should always train an agent prior to sending it queries. See the - // [training - // documentation](https://cloud.google.com/dialogflow/es/docs/training). - rpc RestoreAgent(RestoreAgentRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/agent:restore" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/agent:restore" - body: "*" - } - }; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Struct" - }; - } - - // Gets agent validation result. Agent validation is performed during - // training time and is updated automatically when training is completed. - rpc GetValidationResult(GetValidationResultRequest) returns (ValidationResult) { - option (google.api.http) = { - get: "/v2/{parent=projects/*}/agent/validationResult" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*}/agent/validationResult" - } - }; - } -} - -// A Dialogflow agent is a virtual agent that handles conversations with your -// end-users. It is a natural language understanding module that understands the -// nuances of human language. Dialogflow translates end-user text or audio -// during a conversation to structured data that your apps and services can -// understand. You design and build a Dialogflow agent to handle the types of -// conversations required for your system. -// -// For more information about agents, see the -// [Agent guide](https://cloud.google.com/dialogflow/docs/agents-overview). -// -message Agent { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/Agent" - pattern: "projects/{project}/agent" - pattern: "projects/{project}/locations/{location}/agent" - }; - - // Match mode determines how intents are detected from user queries. - enum MatchMode { - // Not specified. - MATCH_MODE_UNSPECIFIED = 0; - - // Best for agents with a small number of examples in intents and/or wide - // use of templates syntax and composite entities. - MATCH_MODE_HYBRID = 1; - - // Can be used for agents with a large number of examples in intents, - // especially the ones using @sys.any or very large custom entities. - MATCH_MODE_ML_ONLY = 2; - } - - // API version for the agent. - enum ApiVersion { - // Not specified. - API_VERSION_UNSPECIFIED = 0; - - // Legacy V1 API. - API_VERSION_V1 = 1; - - // V2 API. - API_VERSION_V2 = 2; - - // V2beta1 API. - API_VERSION_V2_BETA_1 = 3; - } - - // Represents the agent tier. - enum Tier { - // Not specified. This value should never be used. - TIER_UNSPECIFIED = 0; - - // Standard tier. - TIER_STANDARD = 1; - - // Enterprise tier (Essentials). - TIER_ENTERPRISE = 2; - - // Enterprise tier (Plus). - TIER_ENTERPRISE_PLUS = 3; - } - - // Required. The project of this agent. - // Format: `projects/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Required. The name of this agent. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The default language of the agent as a language tag. See - // [Language - // Support](https://cloud.google.com/dialogflow/docs/reference/language) - // for a list of the currently supported language codes. This field cannot be - // set by the `Update` method. - string default_language_code = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The list of all languages supported by this agent (except for the - // `default_language_code`). - repeated string supported_language_codes = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The time zone of this agent from the - // [time zone database](https://www.iana.org/time-zones), e.g., - // America/New_York, Europe/Paris. - string time_zone = 5 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The description of this agent. - // The maximum length is 500 characters. If exceeded, the request is rejected. - string description = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The URI of the agent's avatar. - // Avatars are used throughout the Dialogflow console and in the self-hosted - // [Web - // Demo](https://cloud.google.com/dialogflow/docs/integrations/web-demo) - // integration. - string avatar_uri = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Determines whether this agent should log conversation queries. - bool enable_logging = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Determines how intents are detected from user queries. - MatchMode match_mode = 9 [ - deprecated = true, - (google.api.field_behavior) = OPTIONAL - ]; - - // Optional. To filter out false positive results and still get variety in - // matched natural language inputs for your agent, you can tune the machine - // learning classification threshold. If the returned score value is less than - // the threshold value, then a fallback intent will be triggered or, if there - // are no fallback intents defined, no intent will be triggered. The score - // values range from 0.0 (completely uncertain) to 1.0 (completely certain). - // If set to 0.0, the default of 0.3 is used. - float classification_threshold = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. API version displayed in Dialogflow console. If not specified, - // V2 API is assumed. Clients are free to query different service endpoints - // for different API versions. However, bots connectors and webhook calls will - // follow the specified API version. - ApiVersion api_version = 14 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The agent tier. If not specified, TIER_STANDARD is assumed. - Tier tier = 15 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [Agents.GetAgent][google.cloud.dialogflow.v2.Agents.GetAgent]. -message GetAgentRequest { - // Required. The project that the agent to fetch is associated with. - // Format: `projects/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Agent" - } - ]; -} - -// The request message for [Agents.SetAgent][google.cloud.dialogflow.v2.Agents.SetAgent]. -message SetAgentRequest { - // Required. The agent to update. - Agent agent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [Agents.DeleteAgent][google.cloud.dialogflow.v2.Agents.DeleteAgent]. -message DeleteAgentRequest { - // Required. The project that the agent to delete is associated with. - // Format: `projects/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Agent" - } - ]; -} - -// The request message for [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents]. -message SearchAgentsRequest { - // Required. The project to list agents from. - // Format: `projects/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Agent" - } - ]; - - // Optional. The maximum number of items to return in a single page. By - // default 100 and at most 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // The next_page_token value returned from a previous list request. - string page_token = 3; -} - -// The response message for [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents]. -message SearchAgentsResponse { - // The list of agents. There will be a maximum number of items returned based - // on the page_size field in the request. - repeated Agent agents = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request message for [Agents.TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent]. -message TrainAgentRequest { - // Required. The project that the agent to train is associated with. - // Format: `projects/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Agent" - } - ]; -} - -// The request message for [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent]. -message ExportAgentRequest { - // Required. The project that the agent to export is associated with. - // Format: `projects/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Agent" - } - ]; - - // Required. The [Google Cloud Storage](https://cloud.google.com/storage/docs/) - // URI to export the agent to. - // The format of this URI must be `gs:///`. - // If left unspecified, the serialized agent is returned inline. - string agent_uri = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The response message for [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent]. -message ExportAgentResponse { - // The exported agent. - oneof agent { - // The URI to a file containing the exported agent. This field is populated - // only if `agent_uri` is specified in `ExportAgentRequest`. - string agent_uri = 1; - - // Zip compressed raw byte content for agent. - bytes agent_content = 2; - } -} - -// The request message for [Agents.ImportAgent][google.cloud.dialogflow.v2.Agents.ImportAgent]. -message ImportAgentRequest { - // Required. The project that the agent to import is associated with. - // Format: `projects/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Agent" - } - ]; - - // Required. The agent to import. - oneof agent { - // The URI to a Google Cloud Storage file containing the agent to import. - // Note: The URI must start with "gs://". - string agent_uri = 2; - - // Zip compressed raw byte content for agent. - bytes agent_content = 3; - } -} - -// The request message for [Agents.RestoreAgent][google.cloud.dialogflow.v2.Agents.RestoreAgent]. -message RestoreAgentRequest { - // Required. The project that the agent to restore is associated with. - // Format: `projects/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Agent" - } - ]; - - // Required. The agent to restore. - oneof agent { - // The URI to a Google Cloud Storage file containing the agent to restore. - // Note: The URI must start with "gs://". - string agent_uri = 2; - - // Zip compressed raw byte content for agent. - bytes agent_content = 3; - } -} - -// The request message for [Agents.GetValidationResult][google.cloud.dialogflow.v2.Agents.GetValidationResult]. -message GetValidationResultRequest { - // Required. The project that the agent is associated with. - // Format: `projects/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Agent" - } - ]; - - // Optional. The language for which you want a validation result. If not - // specified, the agent's default language is used. [Many - // languages](https://cloud.google.com/dialogflow/docs/reference/language) - // are supported. Note: languages must be enabled in the agent before they can - // be used. - string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/answer_record.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/answer_record.proto deleted file mode 100644 index 78aba347..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/answer_record.proto +++ /dev/null @@ -1,292 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dialogflow/v2/participant.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "AnswerRecordsProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; - -// Service for managing [AnswerRecords][google.cloud.dialogflow.v2.AnswerRecord]. -service AnswerRecords { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Returns the list of all answer records in the specified project in reverse - // chronological order. - rpc ListAnswerRecords(ListAnswerRecordsRequest) returns (ListAnswerRecordsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*}/answerRecords" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*}/answerRecords" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Updates the specified answer record. - rpc UpdateAnswerRecord(UpdateAnswerRecordRequest) returns (AnswerRecord) { - option (google.api.http) = { - patch: "/v2/{answer_record.name=projects/*/answerRecords/*}" - body: "answer_record" - additional_bindings { - patch: "/v2/{answer_record.name=projects/*/locations/*/answerRecords/*}" - body: "answer_record" - } - }; - option (google.api.method_signature) = "answer_record,update_mask"; - } -} - -// Answer records are records to manage answer history and feedbacks for -// Dialogflow. -// -// Currently, answer record includes: -// -// - human agent assistant article suggestion -// - human agent assistant faq article -// -// It doesn't include: -// -// - `DetectIntent` intent matching -// - `DetectIntent` knowledge -// -// Answer records are not related to the conversation history in the -// Dialogflow Console. A Record is generated even when the end-user disables -// conversation history in the console. Records are created when there's a human -// agent assistant suggestion generated. -// -// A typical workflow for customers provide feedback to an answer is: -// -// 1. For human agent assistant, customers get suggestion via ListSuggestions -// API. Together with the answers, [AnswerRecord.name][google.cloud.dialogflow.v2.AnswerRecord.name] are returned to the -// customers. -// 2. The customer uses the [AnswerRecord.name][google.cloud.dialogflow.v2.AnswerRecord.name] to call the -// [UpdateAnswerRecord][] method to send feedback about a specific answer -// that they believe is wrong. -message AnswerRecord { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/AnswerRecord" - pattern: "projects/{project}/answerRecords/{answer_record}" - pattern: "projects/{project}/locations/{location}/answerRecords/{answer_record}" - }; - - // The unique identifier of this answer record. - // Format: `projects//locations//answerRecords/`. - string name = 1; - - // Required. The AnswerFeedback for this record. You can set this with - // [AnswerRecords.UpdateAnswerRecord][google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecord] in order to give us feedback about - // this answer. - AnswerFeedback answer_feedback = 2 [(google.api.field_behavior) = REQUIRED]; - - // The record for this answer. - oneof record { - // Output only. The record for human agent assistant. - AgentAssistantRecord agent_assistant_record = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - } -} - -// Request message for [AnswerRecords.ListAnswerRecords][google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords]. -message ListAnswerRecordsRequest { - // Required. The project to list all answer records for in reverse - // chronological order. Format: `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/AnswerRecord" - } - ]; - - // Required. Filters to restrict results to specific answer records. - // Filter on answer record type. Currently predicates on `type` is supported, - // valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`. - // - // For more information about filtering, see - // [API Filtering](https://aip.dev/160). - string filter = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The maximum number of records to return in a single page. - // The server may return fewer records than this. If unspecified, we use 10. - // The maximum is 100. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The - // [ListAnswerRecordsResponse.next_page_token][google.cloud.dialogflow.v2.ListAnswerRecordsResponse.next_page_token] - // value returned from a previous list request used to continue listing on - // the next page. - string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for [AnswerRecords.ListAnswerRecords][google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords]. -message ListAnswerRecordsResponse { - // The list of answer records. - repeated AnswerRecord answer_records = 1; - - // A token to retrieve next page of results. Or empty if there are no more - // results. - // Pass this value in the - // [ListAnswerRecordsRequest.page_token][google.cloud.dialogflow.v2.ListAnswerRecordsRequest.page_token] - // field in the subsequent call to `ListAnswerRecords` method to retrieve the - // next page of results. - string next_page_token = 2; -} - -// Request message for [AnswerRecords.UpdateAnswerRecord][google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecord]. -message UpdateAnswerRecordRequest { - // Required. Answer record to update. - AnswerRecord answer_record = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Represents feedback the customer has about the quality & correctness of a -// certain answer in a conversation. -message AnswerFeedback { - // The correctness level of an answer. - enum CorrectnessLevel { - // Correctness level unspecified. - CORRECTNESS_LEVEL_UNSPECIFIED = 0; - - // Answer is totally wrong. - NOT_CORRECT = 1; - - // Answer is partially correct. - PARTIALLY_CORRECT = 2; - - // Answer is fully correct. - FULLY_CORRECT = 3; - } - - // The correctness level of the specific answer. - CorrectnessLevel correctness_level = 1; - - // Normally, detail feedback is provided when answer is not fully correct. - oneof detail_feedback { - // Detail feedback of agent assist suggestions. - AgentAssistantFeedback agent_assistant_detail_feedback = 2; - } - - // Indicates whether the answer/item was clicked by the human agent - // or not. Default to false. - bool clicked = 3; - - // Time when the answer/item was clicked. - google.protobuf.Timestamp click_time = 5; - - // Indicates whether the answer/item was displayed to the human - // agent in the agent desktop UI. Default to false. - bool displayed = 4; - - // Time when the answer/item was displayed. - google.protobuf.Timestamp display_time = 6; -} - -// Detail feedback of Agent Assist result. -message AgentAssistantFeedback { - // Relevance of an answer. - enum AnswerRelevance { - // Answer relevance unspecified. - ANSWER_RELEVANCE_UNSPECIFIED = 0; - - // Answer is irrelevant to query. - IRRELEVANT = 1; - - // Answer is relevant to query. - RELEVANT = 2; - } - - // Correctness of document. - enum DocumentCorrectness { - // Document correctness unspecified. - DOCUMENT_CORRECTNESS_UNSPECIFIED = 0; - - // Information in document is incorrect. - INCORRECT = 1; - - // Information in document is correct. - CORRECT = 2; - } - - // Efficiency of document. - enum DocumentEfficiency { - // Document efficiency unspecified. - DOCUMENT_EFFICIENCY_UNSPECIFIED = 0; - - // Document is inefficient. - INEFFICIENT = 1; - - // Document is efficient. - EFFICIENT = 2; - } - - // Optional. Whether or not the suggested answer is relevant. - // - // For example: - // - // * Query: "Can I change my mailing address?" - // * Suggested document says: "Items must be returned/exchanged within 60 - // days of the purchase date." - // * [answer_relevance][google.cloud.dialogflow.v2.AgentAssistantFeedback.answer_relevance]: [AnswerRelevance.IRRELEVANT][google.cloud.dialogflow.v2.AgentAssistantFeedback.AnswerRelevance.IRRELEVANT] - AnswerRelevance answer_relevance = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Whether or not the information in the document is correct. - // - // For example: - // - // * Query: "Can I return the package in 2 days once received?" - // * Suggested document says: "Items must be returned/exchanged within 60 - // days of the purchase date." - // * Ground truth: "No return or exchange is allowed." - // * [document_correctness]: INCORRECT - DocumentCorrectness document_correctness = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Whether or not the suggested document is efficient. For example, - // if the document is poorly written, hard to understand, hard to use or - // too long to find useful information, [document_efficiency][google.cloud.dialogflow.v2.AgentAssistantFeedback.document_efficiency] is - // [DocumentEfficiency.INEFFICIENT][google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentEfficiency.INEFFICIENT]. - DocumentEfficiency document_efficiency = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents a record of a human agent assist answer. -message AgentAssistantRecord { - // Output only. The agent assist answer. - oneof answer { - // Output only. The article suggestion answer. - ArticleAnswer article_suggestion_answer = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The FAQ answer. - FaqAnswer faq_answer = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - } -} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/audio_config.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/audio_config.proto deleted file mode 100644 index 53803f51..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/audio_config.proto +++ /dev/null @@ -1,372 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/api/annotations.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "AudioConfigProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -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 -// documentation](https://cloud.google.com/speech-to-text/docs/basics) for more -// details. -enum AudioEncoding { - // Not specified. - AUDIO_ENCODING_UNSPECIFIED = 0; - - // Uncompressed 16-bit signed little-endian samples (Linear PCM). - AUDIO_ENCODING_LINEAR_16 = 1; - - // [`FLAC`](https://xiph.org/flac/documentation.html) (Free Lossless Audio - // Codec) is the recommended encoding because it is lossless (therefore - // recognition is not compromised) and requires only about half the - // bandwidth of `LINEAR16`. `FLAC` stream encoding supports 16-bit and - // 24-bit samples, however, not all fields in `STREAMINFO` are supported. - AUDIO_ENCODING_FLAC = 2; - - // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. - AUDIO_ENCODING_MULAW = 3; - - // Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000. - AUDIO_ENCODING_AMR = 4; - - // Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000. - AUDIO_ENCODING_AMR_WB = 5; - - // Opus encoded audio frames in Ogg container - // ([OggOpus](https://wiki.xiph.org/OggOpus)). - // `sample_rate_hertz` must be 16000. - AUDIO_ENCODING_OGG_OPUS = 6; - - // Although the use of lossy encodings is not recommended, if a very low - // bitrate encoding is required, `OGG_OPUS` is highly preferred over - // Speex encoding. The [Speex](https://speex.org/) encoding supported by - // Dialogflow API has a header byte in each block, as in MIME type - // `audio/x-speex-with-header-byte`. - // It is a variant of the RTP Speex encoding defined in - // [RFC 5574](https://tools.ietf.org/html/rfc5574). - // The stream is a sequence of blocks, one block per RTP packet. Each block - // starts with a byte containing the length of the block, in bytes, followed - // by one or more frames of Speex data, padded to an integral number of - // bytes (octets) as specified in RFC 5574. In other words, each RTP header - // is replaced with a single byte containing the block length. Only Speex - // wideband is supported. `sample_rate_hertz` must be 16000. - AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7; -} - -// Information for a word recognized by the speech recognizer. -message SpeechWordInfo { - // The word this info is for. - string word = 3; - - // Time offset relative to the beginning of the audio that corresponds to the - // start of the spoken word. This is an experimental feature and the accuracy - // of the time offset can vary. - google.protobuf.Duration start_offset = 1; - - // Time offset relative to the beginning of the audio that corresponds to the - // end of the spoken word. This is an experimental feature and the accuracy of - // the time offset can vary. - google.protobuf.Duration end_offset = 2; - - // The Speech confidence between 0.0 and 1.0 for this word. A higher number - // indicates an estimated greater likelihood that the recognized word is - // correct. The default of 0.0 is a sentinel value indicating that confidence - // was not set. - // - // This field is not guaranteed to be fully stable over time for the same - // audio input. Users should also not rely on it to always be provided. - float confidence = 4; -} - -// Variant of the specified [Speech model][google.cloud.dialogflow.v2.InputAudioConfig.model] to use. -// -// See the [Cloud Speech -// documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) -// for which models have different variants. For example, the "phone_call" model -// has both a standard and an enhanced variant. When you use an enhanced model, -// you will generally receive higher quality results than for a standard model. -enum SpeechModelVariant { - // No model variant specified. In this case Dialogflow defaults to - // USE_BEST_AVAILABLE. - SPEECH_MODEL_VARIANT_UNSPECIFIED = 0; - - // Use the best available variant of the [Speech - // model][InputAudioConfig.model] that the caller is eligible for. - // - // Please see the [Dialogflow - // docs](https://cloud.google.com/dialogflow/docs/data-logging) for - // how to make your project eligible for enhanced models. - USE_BEST_AVAILABLE = 1; - - // Use standard model variant even if an enhanced model is available. See the - // [Cloud Speech - // documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) - // for details about enhanced models. - USE_STANDARD = 2; - - // Use an enhanced model variant: - // - // * If an enhanced variant does not exist for the given - // [model][google.cloud.dialogflow.v2.InputAudioConfig.model] and request language, Dialogflow falls - // back to the standard variant. - // - // The [Cloud Speech - // documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) - // describes which models have enhanced variants. - // - // * If the API caller isn't eligible for enhanced models, Dialogflow returns - // an error. Please see the [Dialogflow - // docs](https://cloud.google.com/dialogflow/docs/data-logging) - // for how to make your project eligible. - USE_ENHANCED = 3; -} - -// Instructs the speech recognizer how to process the audio content. -message InputAudioConfig { - // Required. Audio encoding of the audio content to process. - AudioEncoding audio_encoding = 1; - - // Required. Sample rate (in Hertz) of the audio content sent in the query. - // Refer to - // [Cloud Speech API - // documentation](https://cloud.google.com/speech-to-text/docs/basics) for - // more details. - int32 sample_rate_hertz = 2; - - // Required. The language of the supplied audio. Dialogflow does not do - // translations. See [Language - // Support](https://cloud.google.com/dialogflow/docs/reference/language) - // for a list of the currently supported language codes. Note that queries in - // the same session do not necessarily need to specify the same language. - string language_code = 3; - - // If `true`, Dialogflow returns [SpeechWordInfo][google.cloud.dialogflow.v2.SpeechWordInfo] in - // [StreamingRecognitionResult][google.cloud.dialogflow.v2.StreamingRecognitionResult] with information about the recognized speech - // words, e.g. start and end time offsets. If false or unspecified, Speech - // doesn't return any word-level information. - bool enable_word_info = 13; - - // A list of strings containing words and phrases that the speech - // recognizer should recognize with higher likelihood. - // - // See [the Cloud Speech - // documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) - // for more details. - // - // This field is deprecated. Please use [speech_contexts]() instead. If you - // specify both [phrase_hints]() and [speech_contexts](), Dialogflow will - // treat the [phrase_hints]() as a single additional [SpeechContext](). - repeated string phrase_hints = 4 [deprecated = true]; - - // Context information to assist speech recognition. - // - // See [the Cloud Speech - // documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) - // for more details. - repeated SpeechContext speech_contexts = 11; - - // Which Speech model to select for the given request. Select the - // model best suited to your domain to get best results. If a model is not - // explicitly specified, then we auto-select a model based on the parameters - // in the InputAudioConfig. - // If enhanced speech model is enabled for the agent and an enhanced - // version of the specified model for the language does not exist, then the - // speech is recognized using the standard version of the specified model. - // Refer to - // [Cloud Speech API - // documentation](https://cloud.google.com/speech-to-text/docs/basics#select-model) - // for more details. - string model = 7; - - // Which variant of the [Speech model][google.cloud.dialogflow.v2.InputAudioConfig.model] to use. - SpeechModelVariant model_variant = 10; - - // If `false` (default), recognition does not cease until the - // client closes the stream. - // If `true`, the recognizer will detect a single spoken utterance in input - // audio. Recognition ceases when it detects the audio's voice has - // stopped or paused. In this case, once a detected intent is received, the - // client should close the stream and start a new request with a new stream as - // needed. - // Note: This setting is relevant only for streaming methods. - // Note: When specified, InputAudioConfig.single_utterance takes precedence - // over StreamingDetectIntentRequest.single_utterance. - bool single_utterance = 8; - - // Only used in [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] and - // [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent]. - // If `false` and recognition doesn't return any result, trigger - // `NO_SPEECH_RECOGNIZED` event to Dialogflow agent. - bool disable_no_speech_recognized_event = 14; -} - -// Description of which voice to use for speech synthesis. -message VoiceSelectionParams { - // Optional. The name of the voice. If not set, the service will choose a - // voice based on the other parameters such as language_code and - // [ssml_gender][google.cloud.dialogflow.v2.VoiceSelectionParams.ssml_gender]. - string name = 1; - - // Optional. The preferred gender of the voice. If not set, the service will - // choose a voice based on the other parameters such as language_code and - // [name][google.cloud.dialogflow.v2.VoiceSelectionParams.name]. Note that this is only a preference, not requirement. If a - // voice of the appropriate gender is not available, the synthesizer should - // substitute a voice with a different gender rather than failing the request. - SsmlVoiceGender ssml_gender = 2; -} - -// Configuration of how speech should be synthesized. -message SynthesizeSpeechConfig { - // Optional. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is the normal - // native speed supported by the specific voice. 2.0 is twice as fast, and - // 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any - // other values < 0.25 or > 4.0 will return an error. - double speaking_rate = 1; - - // Optional. Speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20 - // semitones from the original pitch. -20 means decrease 20 semitones from the - // original pitch. - double pitch = 2; - - // Optional. Volume gain (in dB) of the normal native volume supported by the - // specific voice, in the range [-96.0, 16.0]. If unset, or set to a value of - // 0.0 (dB), will play at normal native signal amplitude. A value of -6.0 (dB) - // will play at approximately half the amplitude of the normal native signal - // amplitude. A value of +6.0 (dB) will play at approximately twice the - // amplitude of the normal native signal amplitude. We strongly recommend not - // to exceed +10 (dB) as there's usually no effective increase in loudness for - // any value greater than that. - double volume_gain_db = 3; - - // Optional. An identifier which selects 'audio effects' profiles that are - // applied on (post synthesized) text to speech. Effects are applied on top of - // each other in the order they are given. - repeated string effects_profile_id = 5; - - // Optional. The desired voice of the synthesized audio. - VoiceSelectionParams voice = 4; -} - -// Gender of the voice as described in -// [SSML voice element](https://www.w3.org/TR/speech-synthesis11/#edef_voice). -enum SsmlVoiceGender { - // An unspecified gender, which means that the client doesn't care which - // gender the selected voice will have. - SSML_VOICE_GENDER_UNSPECIFIED = 0; - - // A male voice. - SSML_VOICE_GENDER_MALE = 1; - - // A female voice. - SSML_VOICE_GENDER_FEMALE = 2; - - // A gender-neutral voice. - SSML_VOICE_GENDER_NEUTRAL = 3; -} - -// Instructs the speech synthesizer on how to generate the output audio content. -// If this audio config is supplied in a request, it overrides all existing -// text-to-speech settings applied to the agent. -message OutputAudioConfig { - // Required. Audio encoding of the synthesized audio content. - OutputAudioEncoding audio_encoding = 1 [(google.api.field_behavior) = REQUIRED]; - - // The synthesis sample rate (in hertz) for this audio. If not - // provided, then the synthesizer will use the default sample rate based on - // the audio encoding. If this is different from the voice's natural sample - // rate, then the synthesizer will honor this request by converting to the - // desired sample rate (which might result in worse audio quality). - int32 sample_rate_hertz = 2; - - // Configuration of how speech should be synthesized. - SynthesizeSpeechConfig synthesize_speech_config = 3; -} - -// Configures speech transcription for [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]. -message SpeechToTextConfig { - // Optional. The speech model used in speech to text. - // `SPEECH_MODEL_VARIANT_UNSPECIFIED`, `USE_BEST_AVAILABLE` will be treated as - // `USE_ENHANCED`. It can be overridden in [AnalyzeContentRequest][google.cloud.dialogflow.v2.AnalyzeContentRequest] and - // [StreamingAnalyzeContentRequest][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest] request. - SpeechModelVariant speech_model_variant = 1 [(google.api.field_behavior) = OPTIONAL]; -} - -// Audio encoding of the output audio format in Text-To-Speech. -enum OutputAudioEncoding { - // Not specified. - OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0; - - // Uncompressed 16-bit signed little-endian samples (Linear PCM). - // Audio content returned as LINEAR16 also contains a WAV header. - OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1; - - // MP3 audio at 32kbps. - OUTPUT_AUDIO_ENCODING_MP3 = 2; - - // MP3 audio at 64kbps. - OUTPUT_AUDIO_ENCODING_MP3_64_KBPS = 4; - - // Opus encoded audio wrapped in an ogg container. The result will be a - // file which can be played natively on Android, and in browsers (at least - // Chrome and Firefox). The quality of the encoding is considerably higher - // than MP3 while using approximately the same bitrate. - OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3; - - // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. - OUTPUT_AUDIO_ENCODING_MULAW = 5; -} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/context.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/context.proto deleted file mode 100644 index cc6fc325..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/context.proto +++ /dev/null @@ -1,331 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "ContextProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; - -// Service for managing [Contexts][google.cloud.dialogflow.v2.Context]. -service Contexts { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Returns the list of all contexts in the specified session. - rpc ListContexts(ListContextsRequest) returns (ListContextsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/agent/sessions/*}/contexts" - additional_bindings { - get: "/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" - } - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/agent/sessions/*}/contexts" - } - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves the specified context. - rpc GetContext(GetContextRequest) returns (Context) { - option (google.api.http) = { - get: "/v2/{name=projects/*/agent/sessions/*/contexts/*}" - additional_bindings { - get: "/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/locations/*/agent/sessions/*/contexts/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a context. - // - // If the specified context already exists, overrides the context. - rpc CreateContext(CreateContextRequest) returns (Context) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/agent/sessions/*}/contexts" - body: "context" - additional_bindings { - post: "/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" - body: "context" - } - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/agent/sessions/*}/contexts" - body: "context" - } - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" - body: "context" - } - }; - option (google.api.method_signature) = "parent,context"; - } - - // Updates the specified context. - rpc UpdateContext(UpdateContextRequest) returns (Context) { - option (google.api.http) = { - patch: "/v2/{context.name=projects/*/agent/sessions/*/contexts/*}" - body: "context" - additional_bindings { - patch: "/v2/{context.name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" - body: "context" - } - additional_bindings { - patch: "/v2/{context.name=projects/*/locations/*/agent/sessions/*/contexts/*}" - body: "context" - } - additional_bindings { - patch: "/v2/{context.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" - body: "context" - } - }; - option (google.api.method_signature) = "context,update_mask"; - } - - // Deletes the specified context. - rpc DeleteContext(DeleteContextRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/agent/sessions/*/contexts/*}" - additional_bindings { - delete: "/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/agent/sessions/*/contexts/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Deletes all active contexts in the specified session. - rpc DeleteAllContexts(DeleteAllContextsRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{parent=projects/*/agent/sessions/*}/contexts" - additional_bindings { - delete: "/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" - } - additional_bindings { - delete: "/v2/{parent=projects/*/locations/*/agent/sessions/*}/contexts" - } - additional_bindings { - delete: "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" - } - }; - option (google.api.method_signature) = "parent"; - } -} - -// Dialogflow contexts are similar to natural language context. If a person says -// to you "they are orange", you need context in order to understand what "they" -// is referring to. Similarly, for Dialogflow to handle an end-user expression -// like that, it needs to be provided with context in order to correctly match -// an intent. -// -// Using contexts, you can control the flow of a conversation. You can configure -// contexts for an intent by setting input and output contexts, which are -// identified by string names. When an intent is matched, any configured output -// contexts for that intent become active. While any contexts are active, -// Dialogflow is more likely to match intents that are configured with input -// contexts that correspond to the currently active contexts. -// -// For more information about context, see the -// [Contexts guide](https://cloud.google.com/dialogflow/docs/contexts-overview). -message Context { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/Context" - pattern: "projects/{project}/agent/sessions/{session}/contexts/{context}" - pattern: "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}" - pattern: "projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}" - pattern: "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}" - }; - - // Required. The unique identifier of the context. Format: - // `projects//agent/sessions//contexts/`, - // or `projects//agent/environments//users//sessions//contexts/`. - // - // The `Context ID` is always converted to lowercase, may only contain - // characters in a-zA-Z0-9_-% and may be at most 250 bytes long. - // - // If `Environment ID` is not specified, we assume default 'draft' - // environment. If `User ID` is not specified, we assume default '-' user. - // - // The following context names are reserved for internal use by Dialogflow. - // You should not use these contexts or create contexts with these names: - // - // * `__system_counters__` - // * `*_id_dialog_context` - // * `*_dialog_params_size` - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The number of conversational query requests after which the - // context expires. The default is `0`. If set to `0`, the context expires - // immediately. Contexts expire automatically after 20 minutes if there - // are no matching queries. - int32 lifespan_count = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The collection of parameters associated with this context. - // - // Depending on your protocol or client library language, this is a - // map, associative array, symbol table, dictionary, or JSON object - // composed of a collection of (MapKey, MapValue) pairs: - // - // - MapKey type: string - // - MapKey value: parameter name - // - MapValue type: - // - If parameter's entity type is a composite entity: map - // - Else: depending on parameter value type, could be one of string, - // number, boolean, null, list or map - // - MapValue value: - // - If parameter's entity type is a composite entity: - // map from composite entity property names to property values - // - Else: parameter value - google.protobuf.Struct parameters = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts]. -message ListContextsRequest { - // Required. The session to list all contexts from. - // Format: `projects//agent/sessions/` or - // `projects//agent/environments//users//sessions/`. - // If `Environment ID` is not specified, we assume default 'draft' - // environment. If `User ID` is not specified, we assume default '-' user. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Context" - } - ]; - - // Optional. The maximum number of items to return in a single page. By - // default 100 and at most 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response message for [Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts]. -message ListContextsResponse { - // The list of contexts. There will be a maximum number of items - // returned based on the page_size field in the request. - repeated Context contexts = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request message for [Contexts.GetContext][google.cloud.dialogflow.v2.Contexts.GetContext]. -message GetContextRequest { - // Required. The name of the context. Format: - // `projects//agent/sessions//contexts/` - // or `projects//agent/environments//users//sessions//contexts/`. - // If `Environment ID` is not specified, we assume default 'draft' - // environment. If `User ID` is not specified, we assume default '-' user. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Context" - } - ]; -} - -// The request message for [Contexts.CreateContext][google.cloud.dialogflow.v2.Contexts.CreateContext]. -message CreateContextRequest { - // Required. The session to create a context for. - // Format: `projects//agent/sessions/` or - // `projects//agent/environments//users//sessions/`. - // If `Environment ID` is not specified, we assume default 'draft' - // environment. If `User ID` is not specified, we assume default '-' user. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Context" - } - ]; - - // Required. The context to create. - Context context = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [Contexts.UpdateContext][google.cloud.dialogflow.v2.Contexts.UpdateContext]. -message UpdateContextRequest { - // Required. The context to update. - Context context = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [Contexts.DeleteContext][google.cloud.dialogflow.v2.Contexts.DeleteContext]. -message DeleteContextRequest { - // Required. The name of the context to delete. Format: - // `projects//agent/sessions//contexts/` - // or `projects//agent/environments//users//sessions//contexts/`. - // If `Environment ID` is not specified, we assume default 'draft' - // environment. If `User ID` is not specified, we assume default '-' user. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Context" - } - ]; -} - -// The request message for [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2.Contexts.DeleteAllContexts]. -message DeleteAllContextsRequest { - // Required. The name of the session to delete all contexts from. Format: - // `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. - // If `Environment ID` is not specified we assume default 'draft' environment. - // If `User ID` is not specified, we assume default '-' user. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Context" - } - ]; -} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation.proto deleted file mode 100644 index 17e06255..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation.proto +++ /dev/null @@ -1,358 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dialogflow/v2/participant.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "ConversationProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; - -// Service for managing [Conversations][google.cloud.dialogflow.v2.Conversation]. -service Conversations { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Creates a new conversation. Conversations are auto-completed after 24 - // hours. - // - // Conversation Lifecycle: - // There are two stages during a conversation: Automated Agent Stage and - // Assist Stage. - // - // For Automated Agent Stage, there will be a dialogflow agent responding to - // user queries. - // - // For Assist Stage, there's no dialogflow agent responding to user queries. - // But we will provide suggestions which are generated from conversation. - // - // If [Conversation.conversation_profile][google.cloud.dialogflow.v2.Conversation.conversation_profile] is configured for a dialogflow - // agent, conversation will start from `Automated Agent Stage`, otherwise, it - // will start from `Assist Stage`. And during `Automated Agent Stage`, once an - // [Intent][google.cloud.dialogflow.v2.Intent] with [Intent.live_agent_handoff][google.cloud.dialogflow.v2.Intent.live_agent_handoff] is triggered, conversation - // will transfer to Assist Stage. - rpc CreateConversation(CreateConversationRequest) returns (Conversation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/conversations" - body: "conversation" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/conversations" - body: "conversation" - } - }; - option (google.api.method_signature) = "parent,conversation"; - } - - // Returns the list of all conversations in the specified project. - rpc ListConversations(ListConversationsRequest) returns (ListConversationsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*}/conversations" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*}/conversations" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves the specific conversation. - rpc GetConversation(GetConversationRequest) returns (Conversation) { - option (google.api.http) = { - get: "/v2/{name=projects/*/conversations/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/conversations/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Completes the specified conversation. Finished conversations are purged - // from the database after 30 days. - rpc CompleteConversation(CompleteConversationRequest) returns (Conversation) { - option (google.api.http) = { - post: "/v2/{name=projects/*/conversations/*}:complete" - body: "*" - additional_bindings { - post: "/v2/{name=projects/*/locations/*/conversations/*}:complete" - body: "*" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists messages that belong to a given conversation. - // `messages` are ordered by `create_time` in descending order. To fetch - // updates without duplication, send request with filter - // `create_time_epoch_microseconds > - // [first item's create_time of previous request]` and empty page_token. - rpc ListMessages(ListMessagesRequest) returns (ListMessagesResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/conversations/*}/messages" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/conversations/*}/messages" - } - }; - option (google.api.method_signature) = "parent"; - } -} - -// Represents a conversation. -// A conversation is an interaction between an agent, including live agents -// and Dialogflow agents, and a support customer. Conversations can -// include phone calls and text-based chat sessions. -message Conversation { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/Conversation" - pattern: "projects/{project}/conversations/{conversation}" - pattern: "projects/{project}/locations/{location}/conversations/{conversation}" - }; - - // Enumeration of the completion status of the conversation. - enum LifecycleState { - // Unknown. - LIFECYCLE_STATE_UNSPECIFIED = 0; - - // Conversation is currently open for media analysis. - IN_PROGRESS = 1; - - // Conversation has been completed. - COMPLETED = 2; - } - - // Enumeration of the different conversation stages a conversation can be in. - // Reference: - // https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages - enum ConversationStage { - // Unknown. Should never be used after a conversation is successfully - // created. - CONVERSATION_STAGE_UNSPECIFIED = 0; - - // The conversation should return virtual agent responses into the - // conversation. - VIRTUAL_AGENT_STAGE = 1; - - // The conversation should not provide responses, just listen and provide - // suggestions. - HUMAN_ASSIST_STAGE = 2; - } - - // Output only. The unique identifier of this conversation. - // Format: `projects//locations//conversations/`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the Conversation. - LifecycleState lifecycle_state = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. The Conversation Profile to be used to configure this - // Conversation. This field cannot be updated. - // Format: `projects//locations//conversationProfiles/`. - string conversation_profile = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/ConversationProfile" - } - ]; - - // Output only. It will not be empty if the conversation is to be connected over - // telephony. - ConversationPhoneNumber phone_number = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the conversation was started. - google.protobuf.Timestamp start_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the conversation was finished. - google.protobuf.Timestamp end_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The stage of a conversation. It indicates whether the virtual agent or a - // human agent is handling the conversation. - // - // If the conversation is created with the conversation profile that has - // Dialogflow config set, defaults to - // [ConversationStage.VIRTUAL_AGENT_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.VIRTUAL_AGENT_STAGE]; Otherwise, defaults to - // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.HUMAN_ASSIST_STAGE]. - // - // If the conversation is created with the conversation profile that has - // Dialogflow config set but explicitly sets conversation_stage to - // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.HUMAN_ASSIST_STAGE], it skips - // [ConversationStage.VIRTUAL_AGENT_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.VIRTUAL_AGENT_STAGE] stage and directly goes to - // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.HUMAN_ASSIST_STAGE]. - ConversationStage conversation_stage = 7; -} - -// The request message for [Conversations.CreateConversation][google.cloud.dialogflow.v2.Conversations.CreateConversation]. -message CreateConversationRequest { - // Required. Resource identifier of the project creating the conversation. - // Format: `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Conversation" - } - ]; - - // Required. The conversation to create. - Conversation conversation = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Identifier of the conversation. Generally it's auto generated by Google. - // Only set it if you cannot wait for the response to return a - // auto-generated one to you. - // - // The conversation ID must be compliant with the regression fomula - // "[a-zA-Z][a-zA-Z0-9_-]*" with the characters length in range of [3,64]. - // If the field is provided, the caller is resposible for - // 1. the uniqueness of the ID, otherwise the request will be rejected. - // 2. the consistency for whether to use custom ID or not under a project to - // better ensure uniqueness. - string conversation_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [Conversations.ListConversations][google.cloud.dialogflow.v2.Conversations.ListConversations]. -message ListConversationsRequest { - // Required. The project from which to list all conversation. - // Format: `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Conversation" - } - ]; - - // Optional. The maximum number of items to return in a single page. By - // default 100 and at most 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // A filter expression that filters conversations listed in the response. In - // general, the expression must specify the field name, a comparison operator, - // and the value to use for filtering: - //
    - //
  • The value must be a string, a number, or a boolean.
  • - //
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • - //
  • To filter on multiple expressions, separate the - // expressions with `AND` or `OR` (omitting both implies `AND`).
  • - //
  • For clarity, expressions can be enclosed in parentheses.
  • - //
- // Only `lifecycle_state` can be filtered on in this way. For example, - // the following expression only returns `COMPLETED` conversations: - // - // `lifecycle_state = "COMPLETED"` - // - // For more information about filtering, see - // [API Filtering](https://aip.dev/160). - string filter = 4; -} - -// The response message for [Conversations.ListConversations][google.cloud.dialogflow.v2.Conversations.ListConversations]. -message ListConversationsResponse { - // The list of conversations. There will be a maximum number of items - // returned based on the page_size field in the request. - repeated Conversation conversations = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request message for [Conversations.GetConversation][google.cloud.dialogflow.v2.Conversations.GetConversation]. -message GetConversationRequest { - // Required. The name of the conversation. Format: - // `projects//locations//conversations/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Conversation" - } - ]; -} - -// The request message for [Conversations.CompleteConversation][google.cloud.dialogflow.v2.Conversations.CompleteConversation]. -message CompleteConversationRequest { - // Required. Resource identifier of the conversation to close. - // Format: `projects//locations//conversations/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Conversation" - } - ]; -} - -// The request message for [Conversations.ListMessages][google.cloud.dialogflow.v2.Conversations.ListMessages]. -message ListMessagesRequest { - // Required. The name of the conversation to list messages for. - // Format: `projects//locations//conversations/` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Message" - } - ]; - - // Optional. Filter on message fields. Currently predicates on `create_time` - // and `create_time_epoch_microseconds` are supported. `create_time` only - // support milliseconds accuracy. E.g., - // `create_time_epoch_microseconds > 1551790877964485` or - // `create_time > 2017-01-15T01:30:15.01Z`. - // - // For more information about filtering, see - // [API Filtering](https://aip.dev/160). - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of items to return in a single page. By - // default 100 and at most 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response message for [Conversations.ListMessages][google.cloud.dialogflow.v2.Conversations.ListMessages]. -message ListMessagesResponse { - // The list of messages. There will be a maximum number of items - // returned based on the page_size field in the request. - // `messages` is sorted by `create_time` in descending order. - repeated Message messages = 1; - - // Token to retrieve the next page of results, or empty if there are - // no more results in the list. - string next_page_token = 2; -} - -// Represents a phone number for telephony integration. It allows for connecting -// a particular conversation over telephony. -message ConversationPhoneNumber { - // Output only. The phone number to connect to this conversation. - string phone_number = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation_event.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation_event.proto deleted file mode 100644 index 61cfd75f..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation_event.proto +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/cloud/dialogflow/v2/participant.proto"; -import "google/rpc/status.proto"; -import "google/api/annotations.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "ConversationEventProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; - -// Represents a notification sent to Pub/Sub subscribers for conversation -// lifecycle events. -message ConversationEvent { - // Enumeration of the types of events available. - enum Type { - // Type not set. - TYPE_UNSPECIFIED = 0; - - // A new conversation has been opened. This is fired when a telephone call - // is answered, or a conversation is created via the API. - CONVERSATION_STARTED = 1; - - // An existing conversation has closed. This is fired when a telephone call - // is terminated, or a conversation is closed via the API. - CONVERSATION_FINISHED = 2; - - // An existing conversation has received notification from Dialogflow that - // human intervention is required. - HUMAN_INTERVENTION_NEEDED = 3; - - // An existing conversation has received a new message, either from API or - // telephony. It is configured in - // [ConversationProfile.new_message_event_notification_config][google.cloud.dialogflow.v2.ConversationProfile.new_message_event_notification_config] - NEW_MESSAGE = 5; - - // Unrecoverable error during a telephone call. - // - // In general non-recoverable errors only occur if something was - // misconfigured in the ConversationProfile corresponding to the call. After - // a non-recoverable error, Dialogflow may stop responding. - // - // We don't fire this event: - // - // * in an API call because we can directly return the error, or, - // * when we can recover from an error. - UNRECOVERABLE_ERROR = 4; - } - - // The unique identifier of the conversation this notification - // refers to. - // Format: `projects//conversations/`. - string conversation = 1; - - // The type of the event that this notification refers to. - Type type = 2; - - // More detailed information about an error. Only set for type - // UNRECOVERABLE_ERROR_IN_PHONE_CALL. - google.rpc.Status error_status = 3; - - // Payload of conversation event. - oneof payload { - // Payload of NEW_MESSAGE event. - Message new_message_payload = 4; - } -} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation_profile.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation_profile.proto deleted file mode 100644 index 9cae72b7..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/conversation_profile.proto +++ /dev/null @@ -1,594 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dialogflow/v2/audio_config.proto"; -import "google/cloud/dialogflow/v2/participant.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "ConversationProfileProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; -option (google.api.resource_definition) = { - type: "dialogflow.googleapis.com/CXSecuritySettings" - pattern: "projects/{project}/locations/{location}/securitySettings/{security_settings}" -}; -option (google.api.resource_definition) = { - type: "dialogflow.googleapis.com/ConversationModel" - pattern: "projects/{project}/locations/{location}/conversationModels/{conversation_model}" -}; - -// Service for managing [ConversationProfiles][google.cloud.dialogflow.v2.ConversationProfile]. -service ConversationProfiles { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Returns the list of all conversation profiles in the specified project. - rpc ListConversationProfiles(ListConversationProfilesRequest) returns (ListConversationProfilesResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*}/conversationProfiles" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*}/conversationProfiles" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves the specified conversation profile. - rpc GetConversationProfile(GetConversationProfileRequest) returns (ConversationProfile) { - option (google.api.http) = { - get: "/v2/{name=projects/*/conversationProfiles/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/conversationProfiles/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a conversation profile in the specified project. - // - // [ConversationProfile.CreateTime][] and [ConversationProfile.UpdateTime][] - // aren't populated in the response. You can retrieve them via - // [GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile] API. - rpc CreateConversationProfile(CreateConversationProfileRequest) returns (ConversationProfile) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/conversationProfiles" - body: "conversation_profile" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/conversationProfiles" - body: "conversation_profile" - } - }; - option (google.api.method_signature) = "parent,conversation_profile"; - } - - // Updates the specified conversation profile. - // - // [ConversationProfile.CreateTime][] and [ConversationProfile.UpdateTime][] - // aren't populated in the response. You can retrieve them via - // [GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile] API. - rpc UpdateConversationProfile(UpdateConversationProfileRequest) returns (ConversationProfile) { - option (google.api.http) = { - patch: "/v2/{conversation_profile.name=projects/*/conversationProfiles/*}" - body: "conversation_profile" - additional_bindings { - patch: "/v2/{conversation_profile.name=projects/*/locations/*/conversationProfiles/*}" - body: "conversation_profile" - } - }; - option (google.api.method_signature) = "conversation_profile,update_mask"; - } - - // Deletes the specified conversation profile. - rpc DeleteConversationProfile(DeleteConversationProfileRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/conversationProfiles/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/conversationProfiles/*}" - } - }; - option (google.api.method_signature) = "name"; - } -} - -// Defines the services to connect to incoming Dialogflow conversations. -message ConversationProfile { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/ConversationProfile" - pattern: "projects/{project}/conversationProfiles/{conversation_profile}" - pattern: "projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}" - }; - - // The unique identifier of this conversation profile. - // Format: `projects//locations//conversationProfiles/`. - string name = 1; - - // Required. Human readable name for this profile. Max length 1024 bytes. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Output only. Create time of the conversation profile. - google.protobuf.Timestamp create_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Update time of the conversation profile. - google.protobuf.Timestamp update_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Configuration for an automated agent to use with this profile. - AutomatedAgentConfig automated_agent_config = 3; - - // Configuration for agent assistance to use with this profile. - HumanAgentAssistantConfig human_agent_assistant_config = 4; - - // Configuration for connecting to a live agent. - // - // Currently, this feature is not general available, please contact Google - // to get access. - HumanAgentHandoffConfig human_agent_handoff_config = 5; - - // Configuration for publishing conversation lifecycle events. - NotificationConfig notification_config = 6; - - // Configuration for logging conversation lifecycle events. - LoggingConfig logging_config = 7; - - // Configuration for publishing new message events. Event will be sent in - // format of [ConversationEvent][google.cloud.dialogflow.v2.ConversationEvent] - NotificationConfig new_message_event_notification_config = 8; - - // Settings for speech transcription. - SpeechToTextConfig stt_config = 9; - - // Language which represents the conversationProfile. - // If unspecified, the default language code en-us applies. Users need to - // create a ConversationProfile for each language they want to support. - string language_code = 10; -} - -// The request message for [ConversationProfiles.ListConversationProfiles][google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles]. -message ListConversationProfilesRequest { - // Required. The project to list all conversation profiles from. - // Format: `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/ConversationProfile" - } - ]; - - // The maximum number of items to return in a single page. By - // default 100 and at most 1000. - int32 page_size = 2; - - // The next_page_token value returned from a previous list request. - string page_token = 3; -} - -// The response message for [ConversationProfiles.ListConversationProfiles][google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles]. -message ListConversationProfilesResponse { - // The list of project conversation profiles. There is a maximum number - // of items returned based on the page_size field in the request. - repeated ConversationProfile conversation_profiles = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request message for [ConversationProfiles.GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]. -message GetConversationProfileRequest { - // Required. The resource name of the conversation profile. - // Format: `projects//locations//conversationProfiles/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/ConversationProfile" - } - ]; -} - -// The request message for [ConversationProfiles.CreateConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.CreateConversationProfile]. -message CreateConversationProfileRequest { - // Required. The project to create a conversation profile for. - // Format: `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/ConversationProfile" - } - ]; - - // Required. The conversation profile to create. - ConversationProfile conversation_profile = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [ConversationProfiles.UpdateConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.UpdateConversationProfile]. -message UpdateConversationProfileRequest { - // Required. The conversation profile to update. - ConversationProfile conversation_profile = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The mask to control which fields to update. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [ConversationProfiles.DeleteConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.DeleteConversationProfile]. -// -// This operation fails if the conversation profile is still referenced from -// a phone number. -message DeleteConversationProfileRequest { - // Required. The name of the conversation profile to delete. - // Format: `projects//locations//conversationProfiles/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/ConversationProfile" - } - ]; -} - -// Defines the Automated Agent to connect to a conversation. -message AutomatedAgentConfig { - // Required. ID of the Dialogflow agent environment to use. - // - // This project needs to either be the same project as the conversation or you - // need to grant `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow API - // Service Agent` role in this project. - // - // Format: `projects//locations//agent/environments/`. If environment is not - // specified, the default `draft` environment is used. Refer to - // [DetectIntentRequest](/dialogflow/docs/reference/rpc/google.cloud.dialogflow.v2#google.cloud.dialogflow.v2.DetectIntentRequest) - // for more details. - string agent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Agent" - } - ]; -} - -// Defines the Human Agent Assist to connect to a conversation. -message HumanAgentAssistantConfig { - // Settings of suggestion trigger. - message SuggestionTriggerSettings { - // Do not trigger if last utterance is small talk. - bool no_smalltalk = 1; - - // Only trigger suggestion if participant role of last utterance is - // END_USER. - bool only_end_user = 2; - } - - // Config for suggestion features. - message SuggestionFeatureConfig { - // The suggestion feature. - SuggestionFeature suggestion_feature = 5; - - // Automatically iterates all participants and tries to compile - // suggestions. - // - // Supported features: ARTICLE_SUGGESTION, FAQ, DIALOGFLOW_ASSIST. - bool enable_event_based_suggestion = 3; - - // Settings of suggestion trigger. - // - // Currently, only ARTICLE_SUGGESTION and FAQ will use this field. - SuggestionTriggerSettings suggestion_trigger_settings = 10; - - // Configs of query. - SuggestionQueryConfig query_config = 6; - - // Configs of custom conversation model. - ConversationModelConfig conversation_model_config = 7; - } - - // Detail human agent assistant config. - message SuggestionConfig { - // Configuration of different suggestion features. One feature can have only - // one config. - repeated SuggestionFeatureConfig feature_configs = 2; - - // If `group_suggestion_responses` is false, and there are multiple - // `feature_configs` in `event based suggestion` or - // StreamingAnalyzeContent, we will try to deliver suggestions to customers - // as soon as we get new suggestion. Different type of suggestions based on - // the same context will be in separate Pub/Sub event or - // `StreamingAnalyzeContentResponse`. - // - // If `group_suggestion_responses` set to true. All the suggestions to the - // same participant based on the same context will be grouped into a single - // Pub/Sub event or StreamingAnalyzeContentResponse. - bool group_suggestion_responses = 3; - } - - // Config for suggestion query. - message SuggestionQueryConfig { - // Knowledge base source settings. - // - // Supported features: ARTICLE_SUGGESTION, FAQ. - message KnowledgeBaseQuerySource { - // Required. Knowledge bases to query. Format: - // `projects//locations//knowledgeBases/`. Currently, at most 5 knowledge - // bases are supported. - repeated string knowledge_bases = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/KnowledgeBase" - } - ]; - } - - // Document source settings. - // - // Supported features: SMART_REPLY, SMART_COMPOSE. - message DocumentQuerySource { - // Required. Knowledge documents to query from. Format: - // `projects//locations//knowledgeBases//documents/`. - // Currently, at most 5 documents are supported. - repeated string documents = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Document" - } - ]; - } - - // Dialogflow source setting. - // - // Supported feature: DIALOGFLOW_ASSIST. - message DialogflowQuerySource { - // Required. The name of a Dialogflow virtual agent used for end user side intent - // detection and suggestion. Format: `projects//locations//agent`. When multiple agents are allowed in - // the same Dialogflow project. - string agent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Agent" - } - ]; - } - - // Settings that determine how to filter recent conversation context when - // generating suggestions. - message ContextFilterSettings { - // If set to true, the last message from virtual agent (hand off message) - // and the message before it (trigger message of hand off) are dropped. - bool drop_handoff_messages = 1; - - // If set to true, all messages from virtual agent are dropped. - bool drop_virtual_agent_messages = 2; - - // If set to true, all messages from ivr stage are dropped. - bool drop_ivr_messages = 3; - } - - // Source of query. - oneof query_source { - // Query from knowledgebase. It is used by: - // ARTICLE_SUGGESTION, FAQ. - KnowledgeBaseQuerySource knowledge_base_query_source = 1; - - // Query from knowledge base document. It is used by: - // SMART_REPLY, SMART_COMPOSE. - DocumentQuerySource document_query_source = 2; - - // Query from Dialogflow agent. It is used by DIALOGFLOW_ASSIST. - DialogflowQuerySource dialogflow_query_source = 3; - } - - // Maximum number of results to return. Currently, if unset, defaults to 10. - // And the max number is 20. - int32 max_results = 4; - - // Confidence threshold of query result. - // - // Agent Assist gives each suggestion a score in the range [0.0, 1.0], based - // on the relevance between the suggestion and the current conversation - // context. A score of 0.0 has no relevance, while a score of 1.0 has high - // relevance. Only suggestions with a score greater than or equal to the - // value of this field are included in the results. - // - // For a baseline model (the default), the recommended value is in the range - // [0.05, 0.1]. - // - // For a custom model, there is no recommended value. Tune this value by - // starting from a very low value and slowly increasing until you have - // desired results. - // - // If this field is not set, it defaults to 0.0, which means that all - // suggestions are returned. - // - // Supported features: ARTICLE_SUGGESTION. - float confidence_threshold = 5; - - // Determines how recent conversation context is filtered when generating - // suggestions. If unspecified, no messages will be dropped. - ContextFilterSettings context_filter_settings = 7; - } - - // Custom conversation models used in agent assist feature. - // - // Supported feature: ARTICLE_SUGGESTION, SMART_COMPOSE, SMART_REPLY. - message ConversationModelConfig { - // Conversation model resource name. Format: `projects//conversationModels/`. - string model = 1 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/ConversationModel" - }]; - } - - // Configuration for analyses to run on each conversation message. - message MessageAnalysisConfig { - // Enable entity extraction in conversation messages on [agent assist - // stage](https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages). - // If unspecified, defaults to false. - // - // Currently, this feature is not general available, please contact Google - // to get access. - bool enable_entity_extraction = 2; - - // Enable sentiment analysis in conversation messages on [agent assist - // stage](https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages). - // If unspecified, defaults to false. Sentiment analysis inspects user input - // and identifies the prevailing subjective opinion, especially to determine - // a user's attitude as positive, negative, or neutral: - // https://cloud.google.com/natural-language/docs/basics#sentiment_analysis - // For [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent] method, result will be in - // [StreamingAnalyzeContentResponse.message.SentimentAnalysisResult][google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.message]. - // For [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] method, result will be in - // [AnalyzeContentResponse.message.SentimentAnalysisResult][google.cloud.dialogflow.v2.AnalyzeContentResponse.message] - // For [Conversations.ListMessages][google.cloud.dialogflow.v2.Conversations.ListMessages] method, result will be in - // [ListMessagesResponse.messages.SentimentAnalysisResult][google.cloud.dialogflow.v2.ListMessagesResponse.messages] - // If Pub/Sub notification is configured, result will be in - // [ConversationEvent.new_message_payload.SentimentAnalysisResult][google.cloud.dialogflow.v2.ConversationEvent.new_message_payload]. - bool enable_sentiment_analysis = 3; - } - - // Pub/Sub topic on which to publish new agent assistant events. - NotificationConfig notification_config = 2; - - // Configuration for agent assistance of human agent participant. - SuggestionConfig human_agent_suggestion_config = 3; - - // Configuration for agent assistance of end user participant. - // - // Currently, this feature is not general available, please contact Google - // to get access. - SuggestionConfig end_user_suggestion_config = 4; - - // Configuration for message analysis. - MessageAnalysisConfig message_analysis_config = 5; -} - -// Defines the hand off to a live agent, typically on which external agent -// service provider to connect to a conversation. -// -// Currently, this feature is not general available, please contact Google -// to get access. -message HumanAgentHandoffConfig { - // Configuration specific to LivePerson (https://www.liveperson.com). - message LivePersonConfig { - // Required. Account number of the LivePerson account to connect. This is - // the account number you input at the login page. - string account_number = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // Configuration specific to Salesforce Live Agent. - message SalesforceLiveAgentConfig { - // Required. The organization ID of the Salesforce account. - string organization_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Live Agent deployment ID. - string deployment_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Live Agent chat button ID. - string button_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Domain of the Live Agent endpoint for this agent. You can find - // the endpoint URL in the `Live Agent settings` page. For example if URL - // has the form https://d.la4-c2-phx.salesforceliveagent.com/..., - // you should fill in d.la4-c2-phx.salesforceliveagent.com. - string endpoint_domain = 4 [(google.api.field_behavior) = REQUIRED]; - } - - // Required. Specifies which agent service to connect for human agent handoff. - oneof agent_service { - // Uses LivePerson (https://www.liveperson.com). - LivePersonConfig live_person_config = 1; - - // Uses Salesforce Live Agent. - SalesforceLiveAgentConfig salesforce_live_agent_config = 2; - } -} - -// Defines notification behavior. -message NotificationConfig { - // Format of cloud pub/sub message. - enum MessageFormat { - // If it is unspeified, PROTO will be used. - MESSAGE_FORMAT_UNSPECIFIED = 0; - - // Pubsub message will be serialized proto. - PROTO = 1; - - // Pubsub message will be json. - JSON = 2; - } - - // Name of the Pub/Sub topic to publish conversation - // events like - // [CONVERSATION_STARTED][google.cloud.dialogflow.v2.ConversationEvent.Type.CONVERSATION_STARTED] as - // serialized [ConversationEvent][google.cloud.dialogflow.v2.ConversationEvent] protos. - // - // Notification works for phone calls, if this topic either is in the same - // project as the conversation or you grant `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow Service - // Agent` role in the topic project. - // - // Format: `projects//locations//topics/`. - string topic = 1; - - // Format of message. - MessageFormat message_format = 2; -} - -// Defines logging behavior for conversation lifecycle events. -message LoggingConfig { - // Whether to log conversation events like - // [CONVERSATION_STARTED][google.cloud.dialogflow.v2.ConversationEvent.Type.CONVERSATION_STARTED] to - // Stackdriver in the conversation project as JSON format - // [ConversationEvent][google.cloud.dialogflow.v2.ConversationEvent] protos. - bool enable_stackdriver_logging = 3; -} - -// The type of Human Agent Assistant API suggestion to perform, and the maximum -// number of results to return for that type. Multiple `Feature` objects can -// be specified in the `features` list. -message SuggestionFeature { - // Defines the type of Human Agent Assistant feature. - enum Type { - // Unspecified feature type. - TYPE_UNSPECIFIED = 0; - - // Run article suggestion model. - ARTICLE_SUGGESTION = 1; - - // Run FAQ model. - FAQ = 2; - } - - // Type of Human Agent Assistant API feature to request. - Type type = 1; -} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/document.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/document.proto deleted file mode 100644 index a3bc4b77..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/document.proto +++ /dev/null @@ -1,410 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "DocumentProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; - -// Service for managing knowledge [Documents][google.cloud.dialogflow.v2.Document]. -service Documents { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Returns the list of all documents of the knowledge base. - rpc ListDocuments(ListDocumentsRequest) returns (ListDocumentsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/knowledgeBases/*}/documents" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/knowledgeBases/*}/documents" - } - additional_bindings { - get: "/v2/{parent=projects/*/agent/knowledgeBases/*}/documents" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves the specified document. - rpc GetDocument(GetDocumentRequest) returns (Document) { - option (google.api.http) = { - get: "/v2/{name=projects/*/knowledgeBases/*/documents/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/agent/knowledgeBases/*/documents/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new document. - // - // Operation - rpc CreateDocument(CreateDocumentRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/knowledgeBases/*}/documents" - body: "document" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/knowledgeBases/*}/documents" - body: "document" - } - additional_bindings { - post: "/v2/{parent=projects/*/agent/knowledgeBases/*}/documents" - body: "document" - } - }; - option (google.api.method_signature) = "parent,document"; - option (google.longrunning.operation_info) = { - response_type: "Document" - metadata_type: "KnowledgeOperationMetadata" - }; - } - - // Deletes the specified document. - // - // Operation - rpc DeleteDocument(DeleteDocumentRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/knowledgeBases/*/documents/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/agent/knowledgeBases/*/documents/*}" - } - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "KnowledgeOperationMetadata" - }; - } - - // Updates the specified document. - // - // Operation - rpc UpdateDocument(UpdateDocumentRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v2/{document.name=projects/*/knowledgeBases/*/documents/*}" - body: "document" - additional_bindings { - patch: "/v2/{document.name=projects/*/locations/*/knowledgeBases/*/documents/*}" - body: "document" - } - additional_bindings { - patch: "/v2/{document.name=projects/*/agent/knowledgeBases/*/documents/*}" - body: "document" - } - }; - option (google.api.method_signature) = "document,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Document" - metadata_type: "KnowledgeOperationMetadata" - }; - } - - // Reloads the specified document from its specified source, content_uri or - // content. The previously loaded content of the document will be deleted. - // Note: Even when the content of the document has not changed, there still - // may be side effects because of internal implementation changes. - // - // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; - // only use `projects.knowledgeBases.documents`. - // - // Operation - rpc ReloadDocument(ReloadDocumentRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{name=projects/*/knowledgeBases/*/documents/*}:reload" - body: "*" - additional_bindings { - post: "/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}:reload" - body: "*" - } - additional_bindings { - post: "/v2/{name=projects/*/agent/knowledgeBases/*/documents/*}:reload" - body: "*" - } - }; - option (google.api.method_signature) = "name,content_uri"; - option (google.longrunning.operation_info) = { - response_type: "Document" - metadata_type: "KnowledgeOperationMetadata" - }; - } -} - -// A knowledge document to be used by a [KnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBase]. -// -// For more information, see the [knowledge base -// guide](https://cloud.google.com/dialogflow/docs/how/knowledge-bases). -// -// Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; -// only use `projects.knowledgeBases.documents`. -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. - message ReloadStatus { - // The time of a reload attempt. - // This reload may have been triggered automatically or manually and may - // not have succeeded. - google.protobuf.Timestamp time = 1; - - // The status of a reload attempt or the initial load. - google.rpc.Status status = 2; - } - - // The knowledge type of document content. - enum KnowledgeType { - // The type is unspecified or arbitrary. - KNOWLEDGE_TYPE_UNSPECIFIED = 0; - - // The document content contains question and answer pairs as either HTML or - // CSV. Typical FAQ HTML formats are parsed accurately, but unusual formats - // may fail to be parsed. - // - // CSV must have questions in the first column and answers in the second, - // with no header. Because of this explicit format, they are always parsed - // accurately. - FAQ = 1; - - // Documents for which unstructured text is extracted and used for - // question answering. - EXTRACTIVE_QA = 2; - - // The entire document content as a whole can be used for query results. - // Only for Contact Center Solutions on Dialogflow. - ARTICLE_SUGGESTION = 3; - } - - // Optional. The document resource name. - // The name must be empty when creating a document. - // 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 - // less; otherwise, the creation request fails. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The MIME type of this document. - string mime_type = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The knowledge type of document content. - repeated KnowledgeType knowledge_types = 4 [(google.api.field_behavior) = REQUIRED]; - - // Required. The source of this document. - oneof source { - // The URI where the file content is located. - // - // For documents stored in Google Cloud Storage, these URIs must have - // the form `gs:///`. - // - // NOTE: External URLs must correspond to public webpages, i.e., they must - // be indexed by Google Search. In particular, URLs for showing documents in - // Google Cloud Storage (i.e. the URL in your browser) are not supported. - // Instead use the `gs://` format URI described above. - string content_uri = 5; - - // The raw content of the document. This field is only permitted for - // EXTRACTIVE_QA and FAQ knowledge types. - bytes raw_content = 9; - } - - // Optional. If true, we try to automatically reload the document every day - // (at a time picked by the system). If false or unspecified, we don't try - // to automatically reload the document. - // - // Currently you can only enable automatic reload for documents sourced from - // a public url, see `source` field for the source types. - // - // Reload status can be tracked in `latest_reload_status`. If a reload - // fails, we will keep the document unchanged. - // - // If a reload fails with internal errors, the system will try to reload the - // document on the next day. - // If a reload fails with non-retriable errors (e.g. PERMISION_DENIED), the - // system will not try to reload the document anymore. You need to manually - // reload the document successfully by calling `ReloadDocument` and clear the - // errors. - bool enable_auto_reload = 11 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The time and status of the latest reload. - // This reload may have been triggered automatically or manually - // and may not have succeeded. - ReloadStatus latest_reload_status = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Metadata for the document. The metadata supports arbitrary - // key-value pairs. Suggested use cases include storing a document's title, - // an external URL distinct from the document's content_uri, etc. - // The max size of a `key` or a `value` of the metadata is 1024 bytes. - map metadata = 7 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [Documents.GetDocument][google.cloud.dialogflow.v2.Documents.GetDocument]. -message GetDocumentRequest { - // Required. The name of the document to retrieve. - // Format `projects//locations//knowledgeBases//documents/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Document" - } - ]; -} - -// Request message for [Documents.ListDocuments][google.cloud.dialogflow.v2.Documents.ListDocuments]. -message ListDocumentsRequest { - // Required. The knowledge base to list all documents for. - // Format: `projects//locations//knowledgeBases/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Document" - } - ]; - - // The maximum number of items to return in a single page. By - // default 10 and at most 100. - int32 page_size = 2; - - // The next_page_token value returned from a previous list request. - string page_token = 3; -} - -// Response message for [Documents.ListDocuments][google.cloud.dialogflow.v2.Documents.ListDocuments]. -message ListDocumentsResponse { - // The list of documents. - repeated Document documents = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// Request message for [Documents.CreateDocument][google.cloud.dialogflow.v2.Documents.CreateDocument]. -message CreateDocumentRequest { - // Required. The knowledge base to create a document for. - // Format: `projects//locations//knowledgeBases/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Document" - } - ]; - - // Required. The document to create. - Document document = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for [Documents.DeleteDocument][google.cloud.dialogflow.v2.Documents.DeleteDocument]. -message DeleteDocumentRequest { - // Required. The name of the document to delete. - // Format: `projects//locations//knowledgeBases//documents/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Document" - } - ]; -} - -// Request message for [Documents.UpdateDocument][google.cloud.dialogflow.v2.Documents.UpdateDocument]. -message UpdateDocumentRequest { - // Required. The document to update. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Not specified means `update all`. - // Currently, only `display_name` can be updated, an InvalidArgument will be - // returned for attempting to update other fields. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [Documents.ReloadDocument][google.cloud.dialogflow.v2.Documents.ReloadDocument]. -message ReloadDocumentRequest { - // Required. The name of the document to reload. - // Format: `projects//locations//knowledgeBases//documents/` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Document" - } - ]; - - // The source for document reloading. - // If provided, the service will load the contents from the source - // and update document in the knowledge base. - oneof source { - // Optional. The path of gcs source file for reloading document content. For now, - // only gcs uri is supported. - // - // For documents stored in Google Cloud Storage, these URIs must have - // the form `gs:///`. - string content_uri = 3 [(google.api.field_behavior) = OPTIONAL]; - } -} - -// Metadata in google::longrunning::Operation for Knowledge operations. -message KnowledgeOperationMetadata { - // States of the operation. - enum State { - // State unspecified. - STATE_UNSPECIFIED = 0; - - // The operation has been created. - PENDING = 1; - - // The operation is currently running. - RUNNING = 2; - - // The operation is done, either cancelled or completed. - DONE = 3; - } - - // Output only. The current state of this operation. - State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/entity_type.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/entity_type.proto deleted file mode 100644 index 3d076d64..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/entity_type.proto +++ /dev/null @@ -1,569 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "EntityTypeProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; - -// Service for managing [EntityTypes][google.cloud.dialogflow.v2.EntityType]. -service EntityTypes { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Returns the list of all entity types in the specified agent. - rpc ListEntityTypes(ListEntityTypesRequest) returns (ListEntityTypesResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/agent}/entityTypes" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/agent}/entityTypes" - } - }; - option (google.api.method_signature) = "parent"; - option (google.api.method_signature) = "parent,language_code"; - } - - // Retrieves the specified entity type. - rpc GetEntityType(GetEntityTypeRequest) returns (EntityType) { - option (google.api.http) = { - get: "/v2/{name=projects/*/agent/entityTypes/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/agent/entityTypes/*}" - } - }; - option (google.api.method_signature) = "name"; - option (google.api.method_signature) = "name,language_code"; - } - - // Creates an entity type in the specified agent. - // - // Note: You should always train an agent prior to sending it queries. See the - // [training - // documentation](https://cloud.google.com/dialogflow/es/docs/training). - rpc CreateEntityType(CreateEntityTypeRequest) returns (EntityType) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/agent}/entityTypes" - body: "entity_type" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/agent}/entityTypes" - body: "entity_type" - } - }; - option (google.api.method_signature) = "parent,entity_type"; - option (google.api.method_signature) = "parent,entity_type,language_code"; - } - - // Updates the specified entity type. - // - // Note: You should always train an agent prior to sending it queries. See the - // [training - // documentation](https://cloud.google.com/dialogflow/es/docs/training). - rpc UpdateEntityType(UpdateEntityTypeRequest) returns (EntityType) { - option (google.api.http) = { - patch: "/v2/{entity_type.name=projects/*/agent/entityTypes/*}" - body: "entity_type" - additional_bindings { - patch: "/v2/{entity_type.name=projects/*/locations/*/agent/entityTypes/*}" - body: "entity_type" - } - }; - option (google.api.method_signature) = "entity_type"; - option (google.api.method_signature) = "entity_type,language_code"; - } - - // Deletes the specified entity type. - // - // Note: You should always train an agent prior to sending it queries. See the - // [training - // documentation](https://cloud.google.com/dialogflow/es/docs/training). - rpc DeleteEntityType(DeleteEntityTypeRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/agent/entityTypes/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/agent/entityTypes/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Updates/Creates multiple entity types in the specified agent. - // - // - // Note: You should always train an agent prior to sending it queries. See the - // [training - // documentation](https://cloud.google.com/dialogflow/es/docs/training). - rpc BatchUpdateEntityTypes(BatchUpdateEntityTypesRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/agent}/entityTypes:batchUpdate" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/agent}/entityTypes:batchUpdate" - body: "*" - } - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse" - metadata_type: "google.protobuf.Struct" - }; - } - - // Deletes entity types in the specified agent. - // - // Note: You should always train an agent prior to sending it queries. See the - // [training - // documentation](https://cloud.google.com/dialogflow/es/docs/training). - rpc BatchDeleteEntityTypes(BatchDeleteEntityTypesRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/agent}/entityTypes:batchDelete" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/agent}/entityTypes:batchDelete" - body: "*" - } - }; - option (google.api.method_signature) = "parent,entity_type_names"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Struct" - }; - } - - // Creates multiple new entities in the specified entity type. - // - // Note: You should always train an agent prior to sending it queries. See the - // [training - // documentation](https://cloud.google.com/dialogflow/es/docs/training). - rpc BatchCreateEntities(BatchCreateEntitiesRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchCreate" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchCreate" - body: "*" - } - }; - option (google.api.method_signature) = "parent,entities"; - option (google.api.method_signature) = "parent,entities,language_code"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Struct" - }; - } - - // Updates or creates multiple entities in the specified entity type. This - // method does not affect entities in the entity type that aren't explicitly - // specified in the request. - // - // Note: You should always train an agent prior to sending it queries. See the - // [training - // documentation](https://cloud.google.com/dialogflow/es/docs/training). - rpc BatchUpdateEntities(BatchUpdateEntitiesRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchUpdate" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchUpdate" - body: "*" - } - }; - option (google.api.method_signature) = "parent,entities"; - option (google.api.method_signature) = "parent,entities,language_code"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Struct" - }; - } - - // Deletes entities in the specified entity type. - // - // Note: You should always train an agent prior to sending it queries. See the - // [training - // documentation](https://cloud.google.com/dialogflow/es/docs/training). - rpc BatchDeleteEntities(BatchDeleteEntitiesRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchDelete" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchDelete" - body: "*" - } - }; - option (google.api.method_signature) = "parent,entity_values"; - option (google.api.method_signature) = "parent,entity_values,language_code"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Struct" - }; - } -} - -// Each intent parameter has a type, called the entity type, which dictates -// exactly how data from an end-user expression is extracted. -// -// Dialogflow provides predefined system entities that can match many common -// types of data. For example, there are system entities for matching dates, -// times, colors, email addresses, and so on. You can also create your own -// custom entities for matching custom data. For example, you could define a -// vegetable entity that can match the types of vegetables available for -// purchase with a grocery store agent. -// -// For more information, see the -// [Entity guide](https://cloud.google.com/dialogflow/docs/entities-overview). -message EntityType { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/EntityType" - pattern: "projects/{project}/agent/entityTypes/{entity_type}" - pattern: "projects/{project}/locations/{location}/agent/entityTypes/{entity_type}" - }; - - // An **entity entry** for an associated entity type. - message Entity { - // Required. The primary value associated with this entity entry. - // For example, if the entity type is *vegetable*, the value could be - // *scallions*. - // - // For `KIND_MAP` entity types: - // - // * A reference value to be used in place of synonyms. - // - // For `KIND_LIST` entity types: - // - // * A string that can contain references to other entity types (with or - // without aliases). - string value = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A collection of value synonyms. For example, if the entity type - // is *vegetable*, and `value` is *scallions*, a synonym could be *green - // onions*. - // - // For `KIND_LIST` entity types: - // - // * This collection must contain exactly one synonym equal to `value`. - repeated string synonyms = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Represents kinds of entities. - enum Kind { - // Not specified. This value should be never used. - KIND_UNSPECIFIED = 0; - - // Map entity types allow mapping of a group of synonyms to a reference - // value. - KIND_MAP = 1; - - // List entity types contain a set of entries that do not map to reference - // values. However, list entity types can contain references to other entity - // types (with or without aliases). - KIND_LIST = 2; - - // Regexp entity types allow to specify regular expressions in entries - // values. - KIND_REGEXP = 3; - } - - // Represents different entity type expansion modes. Automated expansion - // allows an agent to recognize values that have not been explicitly listed in - // the entity (for example, new kinds of shopping list items). - enum AutoExpansionMode { - // Auto expansion disabled for the entity. - AUTO_EXPANSION_MODE_UNSPECIFIED = 0; - - // Allows an agent to recognize values that have not been explicitly - // listed in the entity. - AUTO_EXPANSION_MODE_DEFAULT = 1; - } - - // The unique identifier of the entity type. - // Required for [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType] and - // [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes] methods. - // Format: `projects//agent/entityTypes/`. - string name = 1; - - // Required. The name of the entity type. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Indicates the kind of entity type. - Kind kind = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Indicates whether the entity type can be automatically - // expanded. - AutoExpansionMode auto_expansion_mode = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The collection of entity entries associated with the entity type. - repeated Entity entities = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Enables fuzzy entity extraction during classification. - bool enable_fuzzy_extraction = 7 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes]. -message ListEntityTypesRequest { - // Required. The agent to list all entity types from. - // Format: `projects//agent`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/EntityType" - } - ]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of items to return in a single page. By - // default 100 and at most 1000. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes]. -message ListEntityTypesResponse { - // The list of agent entity types. There will be a maximum number of items - // returned based on the page_size field in the request. - repeated EntityType entity_types = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request message for [EntityTypes.GetEntityType][google.cloud.dialogflow.v2.EntityTypes.GetEntityType]. -message GetEntityTypeRequest { - // Required. The name of the entity type. - // Format: `projects//agent/entityTypes/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/EntityType" - } - ]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [EntityTypes.CreateEntityType][google.cloud.dialogflow.v2.EntityTypes.CreateEntityType]. -message CreateEntityTypeRequest { - // Required. The agent to create a entity type for. - // Format: `projects//agent`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/EntityType" - } - ]; - - // Required. The entity type to create. - EntityType entity_type = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType]. -message UpdateEntityTypeRequest { - // Required. The entity type to update. - EntityType entity_type = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [EntityTypes.DeleteEntityType][google.cloud.dialogflow.v2.EntityTypes.DeleteEntityType]. -message DeleteEntityTypeRequest { - // Required. The name of the entity type to delete. - // Format: `projects//agent/entityTypes/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/EntityType" - } - ]; -} - -// The request message for [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes]. -message BatchUpdateEntityTypesRequest { - // Required. The name of the agent to update or create entity types in. - // Format: `projects//agent`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/EntityType" - } - ]; - - // The source of the entity type batch. - // - // For each entity type in the batch: - // - // * If `name` is specified, we update an existing entity type. - // * If `name` is not specified, we create a new entity type. - oneof entity_type_batch { - // The URI to a Google Cloud Storage file containing entity types to update - // or create. The file format can either be a serialized proto (of - // EntityBatch type) or a JSON object. Note: The URI must start with - // "gs://". - string entity_type_batch_uri = 2; - - // The collection of entity types to update or create. - EntityTypeBatch entity_type_batch_inline = 3; - } - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response message for [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes]. -message BatchUpdateEntityTypesResponse { - // The collection of updated or created entity types. - repeated EntityType entity_types = 1; -} - -// The request message for [EntityTypes.BatchDeleteEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntityTypes]. -message BatchDeleteEntityTypesRequest { - // Required. The name of the agent to delete all entities types for. Format: - // `projects//agent`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/EntityType" - } - ]; - - // Required. The names entity types to delete. All names must point to the - // same agent as `parent`. - repeated string entity_type_names = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2.EntityTypes.BatchCreateEntities]. -message BatchCreateEntitiesRequest { - // Required. The name of the entity type to create entities in. Format: - // `projects//agent/entityTypes/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/EntityType" - } - ]; - - // Required. The entities to create. - repeated EntityType.Entity entities = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [EntityTypes.BatchUpdateEntities][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntities]. -message BatchUpdateEntitiesRequest { - // Required. The name of the entity type to update or create entities in. - // Format: `projects//agent/entityTypes/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/EntityType" - } - ]; - - // Required. The entities to update or create. - repeated EntityType.Entity entities = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [EntityTypes.BatchDeleteEntities][google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntities]. -message BatchDeleteEntitiesRequest { - // Required. The name of the entity type to delete entries for. Format: - // `projects//agent/entityTypes/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/EntityType" - } - ]; - - // Required. The reference `values` of the entities to delete. Note that - // these are not fully-qualified names, i.e. they don't start with - // `projects/`. - repeated string entity_values = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// This message is a wrapper around a collection of entity types. -message EntityTypeBatch { - // A collection of entity types. - repeated EntityType entity_types = 1; -} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/environment.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/environment.proto deleted file mode 100644 index a25e7050..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/environment.proto +++ /dev/null @@ -1,390 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dialogflow/v2/audio_config.proto"; -import "google/cloud/dialogflow/v2/fulfillment.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "EnvironmentProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; - -// Service for managing [Environments][google.cloud.dialogflow.v2.Environment]. -service Environments { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Returns the list of all non-default environments of the specified agent. - rpc ListEnvironments(ListEnvironmentsRequest) returns (ListEnvironmentsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/agent}/environments" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/agent}/environments" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves the specified agent environment. - rpc GetEnvironment(GetEnvironmentRequest) returns (Environment) { - option (google.api.http) = { - get: "/v2/{name=projects/*/agent/environments/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/agent/environments/*}" - } - }; - } - - // Creates an agent environment. - rpc CreateEnvironment(CreateEnvironmentRequest) returns (Environment) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/agent}/environments" - body: "environment" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/agent}/environments" - body: "environment" - } - }; - } - - // Updates the specified agent environment. - // - // This method allows you to deploy new agent versions into the environment. - // When an environment is pointed to a new agent version by setting - // `environment.agent_version`, the environment is temporarily set to the - // `LOADING` state. During that time, the environment continues serving the - // previous version of the agent. After the new agent version is done loading, - // the environment is set back to the `RUNNING` state. - // You can use "-" as Environment ID in environment name to update an agent - // version in the default environment. WARNING: this will negate all recent - // changes to the draft agent and can't be undone. You may want to save the - // draft agent to a version before calling this method. - rpc UpdateEnvironment(UpdateEnvironmentRequest) returns (Environment) { - option (google.api.http) = { - patch: "/v2/{environment.name=projects/*/agent/environments/*}" - body: "environment" - additional_bindings { - patch: "/v2/{environment.name=projects/*/locations/*/agent/environments/*}" - body: "environment" - } - }; - } - - // Deletes the specified agent environment. - rpc DeleteEnvironment(DeleteEnvironmentRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/agent/environments/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/agent/environments/*}" - } - }; - } - - // Gets the history of the specified environment. - rpc GetEnvironmentHistory(GetEnvironmentHistoryRequest) returns (EnvironmentHistory) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/agent/environments/*}/history" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/agent/environments/*}/history" - } - }; - } -} - -// You can create multiple versions of your agent and publish them to separate -// environments. -// -// When you edit an agent, you are editing the draft agent. At any point, you -// can save the draft agent as an agent version, which is an immutable snapshot -// of your agent. -// -// When you save the draft agent, it is published to the default environment. -// When you create agent versions, you can publish them to custom environments. -// You can create a variety of custom environments for: -// -// - testing -// - development -// - production -// - etc. -// -// For more information, see the [versions and environments -// guide](https://cloud.google.com/dialogflow/docs/agents-versions). -message Environment { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/Environment" - pattern: "projects/{project}/agent/environments/{environment}" - pattern: "projects/{project}/locations/{location}/agent/environments/{environment}" - }; - - // Represents an environment state. When an environment is pointed to a new - // agent version, the environment is temporarily set to the `LOADING` state. - // During that time, the environment keeps on serving the previous version of - // the agent. After the new agent version is done loading, the environment is - // set back to the `RUNNING` state. - enum State { - // Not specified. This value is not used. - STATE_UNSPECIFIED = 0; - - // Stopped. - STOPPED = 1; - - // Loading. - LOADING = 2; - - // Running. - RUNNING = 3; - } - - // Output only. The unique identifier of this agent environment. - // Supported formats: - // - // - `projects//agent/environments/` - // - `projects//locations//agent/environments/` - // - // The environment ID for the default environment is `-`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The developer-provided description for this environment. - // The maximum length is 500 characters. If exceeded, the request is rejected. - string description = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The agent version loaded into this environment. - // Supported formats: - // - // - `projects//agent/versions/` - // - `projects//locations//agent/versions/` - string agent_version = 3 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Version" - } - ]; - - // Output only. The state of this environment. This field is read-only, i.e., it cannot be - // set by create and update methods. - State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update time of this environment. This field is read-only, i.e., it - // cannot be set by create and update methods. - google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Text to speech settings for this environment. - TextToSpeechSettings text_to_speech_settings = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The fulfillment settings to use for this environment. - Fulfillment fulfillment = 8 [(google.api.field_behavior) = OPTIONAL]; -} - -// Instructs the speech synthesizer on how to generate the output audio content. -message TextToSpeechSettings { - // Optional. Indicates whether text to speech is enabled. Even when this field is false, - // other settings in this proto are still retained. - bool enable_text_to_speech = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Audio encoding of the synthesized audio content. - OutputAudioEncoding output_audio_encoding = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The synthesis sample rate (in hertz) for this audio. If not provided, then - // the synthesizer will use the default sample rate based on the audio - // encoding. If this is different from the voice's natural sample rate, then - // the synthesizer will honor this request by converting to the desired sample - // rate (which might result in worse audio quality). - int32 sample_rate_hertz = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Configuration of how speech should be synthesized, mapping from language - // (https://cloud.google.com/dialogflow/docs/reference/language) to - // SynthesizeSpeechConfig. - map synthesize_speech_configs = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [Environments.ListEnvironments][google.cloud.dialogflow.v2.Environments.ListEnvironments]. -message ListEnvironmentsRequest { - // Required. The agent to list all environments from. - // Format: - // - // - `projects//agent` - // - `projects//locations//agent` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Environment" - } - ]; - - // Optional. The maximum number of items to return in a single page. By default 100 and - // at most 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response message for [Environments.ListEnvironments][google.cloud.dialogflow.v2.Environments.ListEnvironments]. -message ListEnvironmentsResponse { - // The list of agent environments. There will be a maximum number of items - // returned based on the page_size field in the request. - repeated Environment environments = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request message for [Environments.GetEnvironment][google.cloud.dialogflow.v2.Environments.GetEnvironment]. -message GetEnvironmentRequest { - // Required. The name of the environment. - // Supported formats: - // - // - `projects//agent/environments/` - // - `projects//locations//agent/environments/` - // - // The environment ID for the default environment is `-`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Environment" - } - ]; -} - -// The request message for [Environments.CreateEnvironment][google.cloud.dialogflow.v2.Environments.CreateEnvironment]. -message CreateEnvironmentRequest { - // Required. The agent to create an environment for. - // Supported formats: - // - // - `projects//agent` - // - `projects//locations//agent` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Environment" - } - ]; - - // Required. The environment to create. - Environment environment = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The unique id of the new environment. - string environment_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [Environments.UpdateEnvironment][google.cloud.dialogflow.v2.Environments.UpdateEnvironment]. -message UpdateEnvironmentRequest { - // Required. The environment to update. - Environment environment = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. This field is used to prevent accidental overwrite of the default - // environment, which is an operation that cannot be undone. To confirm that - // the caller desires this overwrite, this field must be explicitly set to - // true when updating the default environment (environment ID = `-`). - bool allow_load_to_draft_and_discard_changes = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [Environments.DeleteEnvironment][google.cloud.dialogflow.v2.Environments.DeleteEnvironment]. -message DeleteEnvironmentRequest { - // Required. The name of the environment to delete. - // / Format: - // - // - `projects//agent/environments/` - // - `projects//locations//agent/environments/` - // - // The environment ID for the default environment is `-`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Environment" - } - ]; -} - -// The request message for [Environments.GetEnvironmentHistory][google.cloud.dialogflow.v2.Environments.GetEnvironmentHistory]. -message GetEnvironmentHistoryRequest { - // Required. The name of the environment to retrieve history for. - // Supported formats: - // - // - `projects//agent/environments/` - // - `projects//locations//agent/environments/` - // - // The environment ID for the default environment is `-`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Environment" - } - ]; - - // Optional. The maximum number of items to return in a single page. By default 100 and - // at most 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response message for [Environments.GetEnvironmentHistory][google.cloud.dialogflow.v2.Environments.GetEnvironmentHistory]. -message EnvironmentHistory { - // Represents an environment history entry. - message Entry { - // The agent version loaded into this environment history entry. - string agent_version = 1; - - // The developer-provided description for this environment history entry. - string description = 2; - - // The creation time of this environment history entry. - google.protobuf.Timestamp create_time = 3; - } - - // Output only. The name of the environment this history is for. - // Supported formats: - // - // - `projects//agent/environments/` - // - `projects//locations//agent/environments/` - // - // The environment ID for the default environment is `-`. - string parent = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The list of agent environments. There will be a maximum number of items - // returned based on the page_size field in the request. - repeated Entry entries = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/fulfillment.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/fulfillment.proto deleted file mode 100644 index b4fe186b..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/fulfillment.proto +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/field_mask.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "FulfillmentProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; - -// Service for managing [Fulfillments][google.cloud.dialogflow.v2.Fulfillment]. -service Fulfillments { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Retrieves the fulfillment. - rpc GetFulfillment(GetFulfillmentRequest) returns (Fulfillment) { - option (google.api.http) = { - get: "/v2/{name=projects/*/agent/fulfillment}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/agent/fulfillment}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Updates the fulfillment. - rpc UpdateFulfillment(UpdateFulfillmentRequest) returns (Fulfillment) { - option (google.api.http) = { - patch: "/v2/{fulfillment.name=projects/*/agent/fulfillment}" - body: "fulfillment" - additional_bindings { - patch: "/v2/{fulfillment.name=projects/*/locations/*/agent/fulfillment}" - body: "fulfillment" - } - }; - option (google.api.method_signature) = "fulfillment,update_mask"; - } -} - -// By default, your agent responds to a matched intent with a static response. -// As an alternative, you can provide a more dynamic response by using -// fulfillment. When you enable fulfillment for an intent, Dialogflow responds -// to that intent by calling a service that you define. For example, if an -// end-user wants to schedule a haircut on Friday, your service can check your -// database and respond to the end-user with availability information for -// Friday. -// -// For more information, see the [fulfillment -// guide](https://cloud.google.com/dialogflow/docs/fulfillment-overview). -message Fulfillment { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/Fulfillment" - pattern: "projects/{project}/agent/fulfillment" - pattern: "projects/{project}/locations/{location}/agent/fulfillment" - }; - - // Represents configuration for a generic web service. - // Dialogflow supports two mechanisms for authentications: - // - Basic authentication with username and password. - // - Authentication with additional authentication headers. - // More information could be found at: - // https://cloud.google.com/dialogflow/docs/fulfillment-configure. - message GenericWebService { - // Required. The fulfillment URI for receiving POST requests. - // It must use https protocol. - string uri = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The user name for HTTP Basic authentication. - string username = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The password for HTTP Basic authentication. - string password = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The HTTP request headers to send together with fulfillment requests. - map request_headers = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates if generic web service is created through Cloud Functions - // integration. Defaults to false. - // - // is_cloud_function is deprecated. Cloud functions can be configured by - // its uri as a regular web service now. - bool is_cloud_function = 5 [ - deprecated = true, - (google.api.field_behavior) = OPTIONAL - ]; - } - - // Whether fulfillment is enabled for the specific feature. - message Feature { - // The type of the feature. - enum Type { - // Feature type not specified. - TYPE_UNSPECIFIED = 0; - - // Fulfillment is enabled for SmallTalk. - SMALLTALK = 1; - } - - // The type of the feature that enabled for fulfillment. - Type type = 1; - } - - // Required. The unique identifier of the fulfillment. - // Supported formats: - // - `projects//agent/fulfillment` - // - `projects//locations//agent/fulfillment` - // - // This field is not used for Fulfillment in an Environment. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The human-readable name of the fulfillment, unique within the agent. - // - // This field is not used for Fulfillment in an Environment. - string display_name = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The fulfillment configuration. - oneof fulfillment { - // Configuration for a generic web service. - GenericWebService generic_web_service = 3; - } - - // Optional. Whether fulfillment is enabled. - bool enabled = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The field defines whether the fulfillment is enabled for certain features. - repeated Feature features = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [Fulfillments.GetFulfillment][google.cloud.dialogflow.v2.Fulfillments.GetFulfillment]. -message GetFulfillmentRequest { - // Required. The name of the fulfillment. - // Format: `projects//agent/fulfillment`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Fulfillment" - } - ]; -} - -// The request message for [Fulfillments.UpdateFulfillment][google.cloud.dialogflow.v2.Fulfillments.UpdateFulfillment]. -message UpdateFulfillmentRequest { - // Required. The fulfillment to update. - Fulfillment fulfillment = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The mask to control which fields get updated. If the mask is not - // present, all fields will be updated. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/gcs.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/gcs.proto deleted file mode 100644 index 1fb2dc99..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/gcs.proto +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/api/field_behavior.proto"; -import "google/api/annotations.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "GcsProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto deleted file mode 100644 index f79ce9d4..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/cloud/dialogflow/v2/participant.proto"; -import "google/api/annotations.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "HumanAgentAssistantEventProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; - -// Represents a notification sent to Cloud Pub/Sub subscribers for -// human agent assistant events in a specific conversation. -message HumanAgentAssistantEvent { - // The conversation this notification refers to. - // Format: `projects//conversations/`. - string conversation = 1; - - // The participant that the suggestion is compiled for. - // Format: `projects//conversations//participants/`. It will not be set in legacy workflow. - string participant = 3; - - // The suggestion results payload that this notification refers to. - repeated SuggestionResult suggestion_results = 5; -} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/intent.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/intent.proto deleted file mode 100644 index fae280ce..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/intent.proto +++ /dev/null @@ -1,1097 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dialogflow/v2/audio_config.proto"; -import "google/cloud/dialogflow/v2/context.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "IntentProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; - -// Service for managing [Intents][google.cloud.dialogflow.v2.Intent]. -service Intents { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Returns the list of all intents in the specified agent. - rpc ListIntents(ListIntentsRequest) returns (ListIntentsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/agent}/intents" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/agent}/intents" - } - additional_bindings { - get: "/v2/{parent=projects/*/agent/environments/*}/intents" - } - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/agent/environments/*}/intents" - } - }; - option (google.api.method_signature) = "parent"; - option (google.api.method_signature) = "parent,language_code"; - } - - // Retrieves the specified intent. - rpc GetIntent(GetIntentRequest) returns (Intent) { - option (google.api.http) = { - get: "/v2/{name=projects/*/agent/intents/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/agent/intents/*}" - } - }; - option (google.api.method_signature) = "name"; - option (google.api.method_signature) = "name,language_code"; - } - - // Creates an intent in the specified agent. - // - // Note: You should always train an agent prior to sending it queries. See the - // [training - // documentation](https://cloud.google.com/dialogflow/es/docs/training). - rpc CreateIntent(CreateIntentRequest) returns (Intent) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/agent}/intents" - body: "intent" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/agent}/intents" - body: "intent" - } - }; - option (google.api.method_signature) = "parent,intent"; - option (google.api.method_signature) = "parent,intent,language_code"; - } - - // Updates the specified intent. - // - // Note: You should always train an agent prior to sending it queries. See the - // [training - // documentation](https://cloud.google.com/dialogflow/es/docs/training). - rpc UpdateIntent(UpdateIntentRequest) returns (Intent) { - option (google.api.http) = { - patch: "/v2/{intent.name=projects/*/agent/intents/*}" - body: "intent" - additional_bindings { - patch: "/v2/{intent.name=projects/*/locations/*/agent/intents/*}" - body: "intent" - } - }; - option (google.api.method_signature) = "intent,language_code"; - option (google.api.method_signature) = "intent,language_code,update_mask"; - } - - // Deletes the specified intent and its direct or indirect followup intents. - // - // Note: You should always train an agent prior to sending it queries. See the - // [training - // documentation](https://cloud.google.com/dialogflow/es/docs/training). - rpc DeleteIntent(DeleteIntentRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/agent/intents/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/agent/intents/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Updates/Creates multiple intents in the specified agent. - // - // - // Note: You should always train an agent prior to sending it queries. See the - // [training - // documentation](https://cloud.google.com/dialogflow/es/docs/training). - rpc BatchUpdateIntents(BatchUpdateIntentsRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/agent}/intents:batchUpdate" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/agent}/intents:batchUpdate" - body: "*" - } - }; - option (google.api.method_signature) = "parent,intent_batch_uri"; - option (google.api.method_signature) = "parent,intent_batch_inline"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.dialogflow.v2.BatchUpdateIntentsResponse" - metadata_type: "google.protobuf.Struct" - }; - } - - // Deletes intents in the specified agent. - // - // - // Note: You should always train an agent prior to sending it queries. See the - // [training - // documentation](https://cloud.google.com/dialogflow/es/docs/training). - rpc BatchDeleteIntents(BatchDeleteIntentsRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/agent}/intents:batchDelete" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/agent}/intents:batchDelete" - body: "*" - } - }; - option (google.api.method_signature) = "parent,intents"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Struct" - }; - } -} - -// An intent categorizes an end-user's intention for one conversation turn. For -// each agent, you define many intents, where your combined intents can handle a -// complete conversation. When an end-user writes or says something, referred to -// as an end-user expression or end-user input, Dialogflow matches the end-user -// input to the best intent in your agent. Matching an intent is also known as -// intent classification. -// -// For more information, see the [intent -// guide](https://cloud.google.com/dialogflow/docs/intents-overview). -message Intent { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/Intent" - pattern: "projects/{project}/agent/intents/{intent}" - pattern: "projects/{project}/locations/{location}/agent/intents/{intent}" - }; - - // Represents an example that the agent is trained on. - message TrainingPhrase { - // Represents a part of a training phrase. - message Part { - // Required. The text for this part. - string text = 1; - - // Optional. The entity type name prefixed with `@`. - // This field is required for annotated parts of the training phrase. - string entity_type = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The parameter name for the value extracted from the - // annotated part of the example. - // This field is required for annotated parts of the training phrase. - string alias = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates whether the text was manually annotated. - // This field is set to true when the Dialogflow Console is used to - // manually annotate the part. When creating an annotated part with the - // API, you must set this to true. - bool user_defined = 4 [(google.api.field_behavior) = OPTIONAL]; - } - - // Represents different types of training phrases. - enum Type { - // Not specified. This value should never be used. - TYPE_UNSPECIFIED = 0; - - // Examples do not contain @-prefixed entity type names, but example parts - // can be annotated with entity types. - EXAMPLE = 1; - - // Templates are not annotated with entity types, but they can contain - // @-prefixed entity type names as substrings. - // Template mode has been deprecated. Example mode is the only supported - // way to create new training phrases. If you have existing training - // phrases that you've created in template mode, those will continue to - // work. - TEMPLATE = 2 [deprecated = true]; - } - - // Output only. The unique identifier of this training phrase. - string name = 1; - - // Required. The type of the training phrase. - Type type = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ordered list of training phrase parts. - // The parts are concatenated in order to form the training phrase. - // - // Note: The API does not automatically annotate training phrases like the - // Dialogflow Console does. - // - // Note: Do not forget to include whitespace at part boundaries, - // so the training phrase is well formatted when the parts are concatenated. - // - // If the training phrase does not need to be annotated with parameters, - // you just need a single part with only the [Part.text][google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part.text] field set. - // - // If you want to annotate the training phrase, you must create multiple - // parts, where the fields of each part are populated in one of two ways: - // - // - `Part.text` is set to a part of the phrase that has no parameters. - // - `Part.text` is set to a part of the phrase that you want to annotate, - // and the `entity_type`, `alias`, and `user_defined` fields are all - // set. - repeated Part parts = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Indicates how many times this example was added to - // the intent. Each time a developer adds an existing sample by editing an - // intent or training, this counter is increased. - int32 times_added_count = 4 [(google.api.field_behavior) = OPTIONAL]; - } - - // Represents intent parameters. - message Parameter { - // The unique identifier of this parameter. - string name = 1; - - // Required. The name of the parameter. - string display_name = 2; - - // Optional. The definition of the parameter value. It can be: - // - // - a constant string, - // - a parameter value defined as `$parameter_name`, - // - an original parameter value defined as `$parameter_name.original`, - // - a parameter value from some context defined as - // `#context_name.parameter_name`. - string value = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The default value to use when the `value` yields an empty - // result. - // Default values can be extracted from contexts by using the following - // syntax: `#context_name.parameter_name`. - string default_value = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The name of the entity type, prefixed with `@`, that - // describes values of the parameter. If the parameter is - // required, this must be provided. - string entity_type_display_name = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates whether the parameter is required. That is, - // whether the intent cannot be completed without collecting the parameter - // value. - bool mandatory = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The collection of prompts that the agent can present to the - // user in order to collect a value for the parameter. - repeated string prompts = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates whether the parameter represents a list of values. - bool is_list = 8 [(google.api.field_behavior) = OPTIONAL]; - } - - // A rich response message. - // Corresponds to the intent `Response` field in the Dialogflow console. - // For more information, see - // [Rich response - // messages](https://cloud.google.com/dialogflow/docs/intents-rich-messages). - message Message { - // The text response message. - message Text { - // Optional. The collection of the agent's responses. - repeated string text = 1 [(google.api.field_behavior) = OPTIONAL]; - } - - // The image response message. - message Image { - // Optional. The public URI to an image file. - string image_uri = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A text description of the image to be used for accessibility, - // e.g., screen readers. - string accessibility_text = 2 [(google.api.field_behavior) = OPTIONAL]; - } - - // The quick replies response message. - message QuickReplies { - // Optional. The title of the collection of quick replies. - string title = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The collection of quick replies. - repeated string quick_replies = 2 [(google.api.field_behavior) = OPTIONAL]; - } - - // The card response message. - message Card { - // Contains information about a button. - message Button { - // Optional. The text to show on the button. - string text = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The text to send back to the Dialogflow API or a URI to - // open. - string postback = 2 [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. The title of the card. - string title = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The subtitle of the card. - string subtitle = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The public URI to an image file for the card. - string image_uri = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The collection of card buttons. - repeated Button buttons = 4 [(google.api.field_behavior) = OPTIONAL]; - } - - // The simple response message containing speech or text. - message SimpleResponse { - // One of text_to_speech or ssml must be provided. The plain text of the - // speech output. Mutually exclusive with ssml. - string text_to_speech = 1; - - // One of text_to_speech or ssml must be provided. Structured spoken - // response to the user in the SSML format. Mutually exclusive with - // text_to_speech. - string ssml = 2; - - // Optional. The text to display. - string display_text = 3 [(google.api.field_behavior) = OPTIONAL]; - } - - // The collection of simple response candidates. - // This message in `QueryResult.fulfillment_messages` and - // `WebhookResponse.fulfillment_messages` should contain only one - // `SimpleResponse`. - message SimpleResponses { - // Required. The list of simple responses. - repeated SimpleResponse simple_responses = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // The basic card message. Useful for displaying information. - message BasicCard { - // The button object that appears at the bottom of a card. - message Button { - // Opens the given URI. - message OpenUriAction { - // Required. The HTTP or HTTPS scheme URI. - string uri = 1; - } - - // Required. The title of the button. - string title = 1; - - // Required. Action to take when a user taps on the button. - OpenUriAction open_uri_action = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Optional. The title of the card. - string title = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The subtitle of the card. - string subtitle = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required, unless image is present. The body text of the card. - string formatted_text = 3; - - // Optional. The image for the card. - Image image = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The collection of card buttons. - repeated Button buttons = 5 [(google.api.field_behavior) = OPTIONAL]; - } - - // The suggestion chip message that the user can tap to quickly post a reply - // to the conversation. - message Suggestion { - // Required. The text shown the in the suggestion chip. - string title = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // The collection of suggestions. - message Suggestions { - // Required. The list of suggested replies. - repeated Suggestion suggestions = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // The suggestion chip message that allows the user to jump out to the app - // or website associated with this agent. - message LinkOutSuggestion { - // Required. The name of the app or site this chip is linking to. - string destination_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The URI of the app or site to open when the user taps the - // suggestion chip. - string uri = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // The card for presenting a list of options to select from. - message ListSelect { - // An item in the list. - message Item { - // Required. Additional information about this option. - SelectItemInfo info = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The title of the list item. - string title = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The main text describing the item. - string description = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The image to display. - Image image = 4 [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. The overall title of the list. - string title = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. List items. - repeated Item items = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Subtitle of the list. - string subtitle = 3 [(google.api.field_behavior) = OPTIONAL]; - } - - // The card for presenting a carousel of options to select from. - message CarouselSelect { - // An item in the carousel. - message Item { - // Required. Additional info about the option item. - SelectItemInfo info = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Title of the carousel item. - string title = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The body text of the card. - string description = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The image to display. - Image image = 4 [(google.api.field_behavior) = OPTIONAL]; - } - - // Required. Carousel items. - repeated Item items = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // Additional info about the select item for when it is triggered in a - // dialog. - message SelectItemInfo { - // Required. A unique key that will be sent back to the agent if this - // response is given. - string key = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A list of synonyms that can also be used to trigger this - // item in dialog. - repeated string synonyms = 2 [(google.api.field_behavior) = OPTIONAL]; - } - - // The media content card for Actions on Google. - message MediaContent { - // Response media object for media content card. - message ResponseMediaObject { - // Required. Name of media card. - string name = 1; - - // Optional. Description of media card. - string description = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Image to show with the media card. - oneof image { - // Optional. Image to display above media content. - Image large_image = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Icon to display above media content. - Image icon = 4 [(google.api.field_behavior) = OPTIONAL]; - } - - // Required. Url where the media is stored. - string content_url = 5; - } - - // Format of response media type. - enum ResponseMediaType { - // Unspecified. - RESPONSE_MEDIA_TYPE_UNSPECIFIED = 0; - - // Response media type is audio. - AUDIO = 1; - } - - // Optional. What type of media is the content (ie "audio"). - ResponseMediaType media_type = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. List of media objects. - repeated ResponseMediaObject media_objects = 2; - } - - // Browse Carousel Card for Actions on Google. - // https://developers.google.com/actions/assistant/responses#browsing_carousel - message BrowseCarouselCard { - // Browsing carousel tile - message BrowseCarouselCardItem { - // Actions on Google action to open a given url. - message OpenUrlAction { - // Type of the URI. - enum UrlTypeHint { - // Unspecified - URL_TYPE_HINT_UNSPECIFIED = 0; - - // Url would be an amp action - AMP_ACTION = 1; - - // URL that points directly to AMP content, or to a canonical URL - // which refers to AMP content via . - AMP_CONTENT = 2; - } - - // Required. URL - string url = 1; - - // Optional. Specifies the type of viewer that is used when opening - // the URL. Defaults to opening via web browser. - UrlTypeHint url_type_hint = 3 [(google.api.field_behavior) = OPTIONAL]; - } - - // Required. Action to present to the user. - OpenUrlAction open_uri_action = 1; - - // Required. Title of the carousel item. Maximum of two lines of text. - string title = 2; - - // Optional. Description of the carousel item. Maximum of four lines of - // text. - string description = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Hero image for the carousel item. - Image image = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Text that appears at the bottom of the Browse Carousel - // Card. Maximum of one line of text. - string footer = 5 [(google.api.field_behavior) = OPTIONAL]; - } - - // Image display options for Actions on Google. This should be used for - // when the image's aspect ratio does not match the image container's - // aspect ratio. - enum ImageDisplayOptions { - // Fill the gaps between the image and the image container with gray - // bars. - IMAGE_DISPLAY_OPTIONS_UNSPECIFIED = 0; - - // Fill the gaps between the image and the image container with gray - // bars. - GRAY = 1; - - // Fill the gaps between the image and the image container with white - // bars. - WHITE = 2; - - // Image is scaled such that the image width and height match or exceed - // the container dimensions. This may crop the top and bottom of the - // image if the scaled image height is greater than the container - // height, or crop the left and right of the image if the scaled image - // width is greater than the container width. This is similar to "Zoom - // Mode" on a widescreen TV when playing a 4:3 video. - CROPPED = 3; - - // Pad the gaps between image and image frame with a blurred copy of the - // same image. - BLURRED_BACKGROUND = 4; - } - - // Required. List of items in the Browse Carousel Card. Minimum of two - // items, maximum of ten. - repeated BrowseCarouselCardItem items = 1; - - // Optional. Settings for displaying the image. Applies to every image in - // [items][google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.items]. - ImageDisplayOptions image_display_options = 2 [(google.api.field_behavior) = OPTIONAL]; - } - - // Table card for Actions on Google. - message TableCard { - // Required. Title of the card. - string title = 1; - - // Optional. Subtitle to the title. - string subtitle = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Image which should be displayed on the card. - Image image = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Display properties for the columns in this table. - repeated ColumnProperties column_properties = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Rows in this table of data. - repeated TableCardRow rows = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. List of buttons for the card. - repeated BasicCard.Button buttons = 6 [(google.api.field_behavior) = OPTIONAL]; - } - - // Column properties for [TableCard][google.cloud.dialogflow.v2.Intent.Message.TableCard]. - message ColumnProperties { - // Text alignments within a cell. - enum HorizontalAlignment { - // Text is aligned to the leading edge of the column. - HORIZONTAL_ALIGNMENT_UNSPECIFIED = 0; - - // Text is aligned to the leading edge of the column. - LEADING = 1; - - // Text is centered in the column. - CENTER = 2; - - // Text is aligned to the trailing edge of the column. - TRAILING = 3; - } - - // Required. Column heading. - string header = 1; - - // Optional. Defines text alignment for all cells in this column. - HorizontalAlignment horizontal_alignment = 2 [(google.api.field_behavior) = OPTIONAL]; - } - - // Row of [TableCard][google.cloud.dialogflow.v2.Intent.Message.TableCard]. - message TableCardRow { - // Optional. List of cells that make up this row. - repeated TableCardCell cells = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Whether to add a visual divider after this row. - bool divider_after = 2 [(google.api.field_behavior) = OPTIONAL]; - } - - // Cell of [TableCardRow][google.cloud.dialogflow.v2.Intent.Message.TableCardRow]. - message TableCardCell { - // Required. Text in this cell. - string text = 1; - } - - // The rich response message integration platform. See - // [Integrations](https://cloud.google.com/dialogflow/docs/integrations). - enum Platform { - // Default platform. - PLATFORM_UNSPECIFIED = 0; - - // Facebook. - FACEBOOK = 1; - - // Slack. - SLACK = 2; - - // Telegram. - TELEGRAM = 3; - - // Kik. - KIK = 4; - - // Skype. - SKYPE = 5; - - // Line. - LINE = 6; - - // Viber. - VIBER = 7; - - // Google Assistant - // See [Dialogflow webhook - // format](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json) - ACTIONS_ON_GOOGLE = 8; - - // Google Hangouts. - GOOGLE_HANGOUTS = 11; - } - - // Required. The rich response message. - oneof message { - // The text response. - Text text = 1; - - // The image response. - Image image = 2; - - // The quick replies response. - QuickReplies quick_replies = 3; - - // The card response. - Card card = 4; - - // A custom platform-specific response. - google.protobuf.Struct payload = 5; - - // The voice and text-only responses for Actions on Google. - SimpleResponses simple_responses = 7; - - // The basic card response for Actions on Google. - BasicCard basic_card = 8; - - // The suggestion chips for Actions on Google. - Suggestions suggestions = 9; - - // The link out suggestion chip for Actions on Google. - LinkOutSuggestion link_out_suggestion = 10; - - // The list card response for Actions on Google. - ListSelect list_select = 11; - - // The carousel card response for Actions on Google. - CarouselSelect carousel_select = 12; - - // Browse carousel card for Actions on Google. - BrowseCarouselCard browse_carousel_card = 22; - - // Table card for Actions on Google. - TableCard table_card = 23; - - // The media content card for Actions on Google. - MediaContent media_content = 24; - } - - // Optional. The platform that this message is intended for. - Platform platform = 6 [(google.api.field_behavior) = OPTIONAL]; - } - - // Represents a single followup intent in the chain. - message FollowupIntentInfo { - // The unique identifier of the followup intent. - // Format: `projects//agent/intents/`. - string followup_intent_name = 1; - - // The unique identifier of the followup intent's parent. - // Format: `projects//agent/intents/`. - string parent_followup_intent_name = 2; - } - - // Represents the different states that webhooks can be in. - enum WebhookState { - // Webhook is disabled in the agent and in the intent. - WEBHOOK_STATE_UNSPECIFIED = 0; - - // Webhook is enabled in the agent and in the intent. - WEBHOOK_STATE_ENABLED = 1; - - // Webhook is enabled in the agent and in the intent. Also, each slot - // filling prompt is forwarded to the webhook. - WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING = 2; - } - - // Optional. The unique identifier of this intent. - // Required for [Intents.UpdateIntent][google.cloud.dialogflow.v2.Intents.UpdateIntent] and [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2.Intents.BatchUpdateIntents] - // methods. - // Format: `projects//agent/intents/`. - string name = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The name of this intent. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Indicates whether webhooks are enabled for the intent. - WebhookState webhook_state = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The priority of this intent. Higher numbers represent higher - // priorities. - // - // - If the supplied value is unspecified or 0, the service - // translates the value to 500,000, which corresponds to the - // `Normal` priority in the console. - // - If the supplied value is negative, the intent is ignored - // in runtime detect intent requests. - int32 priority = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates whether this is a fallback intent. - bool is_fallback = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates whether Machine Learning is disabled for the intent. - // Note: If `ml_disabled` setting is set to true, then this intent is not - // taken into account during inference in `ML ONLY` match mode. Also, - // auto-markup in the UI is turned off. - bool ml_disabled = 19 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates that a live agent should be brought in to handle the - // interaction with the user. In most cases, when you set this flag to true, - // you would also want to set end_interaction to true as well. Default is - // false. - bool live_agent_handoff = 20 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates that this intent ends an interaction. Some integrations - // (e.g., Actions on Google or Dialogflow phone gateway) use this information - // to close interaction with an end user. Default is false. - bool end_interaction = 21 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The list of context names required for this intent to be - // triggered. - // Format: `projects//agent/sessions/-/contexts/`. - repeated string input_context_names = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The collection of event names that trigger the intent. - // If the collection of input contexts is not empty, all of the contexts must - // be present in the active user session for an event to trigger this intent. - // Event names are limited to 150 characters. - repeated string events = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The collection of examples that the agent is - // trained on. - repeated TrainingPhrase training_phrases = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The name of the action associated with the intent. - // Note: The action name must not contain whitespaces. - string action = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The collection of contexts that are activated when the intent - // is matched. Context messages in this collection should not set the - // parameters field. Setting the `lifespan_count` to 0 will reset the context - // when the intent is matched. - // Format: `projects//agent/sessions/-/contexts/`. - repeated Context output_contexts = 11 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates whether to delete all contexts in the current - // session when this intent is matched. - bool reset_contexts = 12 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The collection of parameters associated with the intent. - repeated Parameter parameters = 13 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The collection of rich messages corresponding to the - // `Response` field in the Dialogflow console. - repeated Message messages = 14 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The list of platforms for which the first responses will be - // copied from the messages in PLATFORM_UNSPECIFIED (i.e. default platform). - repeated Message.Platform default_response_platforms = 15 [(google.api.field_behavior) = OPTIONAL]; - - // Read-only. The unique identifier of the root intent in the chain of - // followup intents. It identifies the correct followup intents chain for - // this intent. We populate this field only in the output. - // - // Format: `projects//agent/intents/`. - string root_followup_intent_name = 16; - - // Read-only after creation. The unique identifier of the parent intent in the - // chain of followup intents. You can set this field when creating an intent, - // for example with [CreateIntent][google.cloud.dialogflow.v2.Intents.CreateIntent] or - // [BatchUpdateIntents][google.cloud.dialogflow.v2.Intents.BatchUpdateIntents], in order to make this - // intent a followup intent. - // - // It identifies the parent followup intent. - // Format: `projects//agent/intents/`. - string parent_followup_intent_name = 17; - - // Read-only. Information about all followup intents that have this intent as - // a direct or indirect parent. We populate this field only in the output. - repeated FollowupIntentInfo followup_intent_info = 18; -} - -// The request message for [Intents.ListIntents][google.cloud.dialogflow.v2.Intents.ListIntents]. -message ListIntentsRequest { - // Required. The agent to list all intents from. - // Format: `projects//agent` or `projects//locations//agent`. - // - // Alternatively, you can specify the environment to list intents for. - // Format: `projects//agent/environments/` - // or `projects//locations//agent/environments/`. - // Note: training phrases of the intents will not be returned for non-draft - // environment. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Intent" - } - ]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The resource view to apply to the returned intent. - IntentView intent_view = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of items to return in a single page. By - // default 100 and at most 1000. - int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response message for [Intents.ListIntents][google.cloud.dialogflow.v2.Intents.ListIntents]. -message ListIntentsResponse { - // The list of agent intents. There will be a maximum number of items - // returned based on the page_size field in the request. - repeated Intent intents = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request message for [Intents.GetIntent][google.cloud.dialogflow.v2.Intents.GetIntent]. -message GetIntentRequest { - // Required. The name of the intent. - // Format: `projects//agent/intents/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Intent" - } - ]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The resource view to apply to the returned intent. - IntentView intent_view = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [Intents.CreateIntent][google.cloud.dialogflow.v2.Intents.CreateIntent]. -message CreateIntentRequest { - // Required. The agent to create a intent for. - // Format: `projects//agent`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Intent" - } - ]; - - // Required. The intent to create. - Intent intent = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The resource view to apply to the returned intent. - IntentView intent_view = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [Intents.UpdateIntent][google.cloud.dialogflow.v2.Intents.UpdateIntent]. -message UpdateIntentRequest { - // Required. The intent to update. - Intent intent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The resource view to apply to the returned intent. - IntentView intent_view = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [Intents.DeleteIntent][google.cloud.dialogflow.v2.Intents.DeleteIntent]. -message DeleteIntentRequest { - // Required. The name of the intent to delete. If this intent has direct or - // indirect followup intents, we also delete them. - // Format: `projects//agent/intents/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Intent" - } - ]; -} - -message BatchUpdateIntentsRequest { - // Required. The name of the agent to update or create intents in. - // Format: `projects//agent`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Intent" - } - ]; - - // The source of the intent batch. - oneof intent_batch { - // The URI to a Google Cloud Storage file containing intents to update or - // create. The file format can either be a serialized proto (of IntentBatch - // type) or JSON object. Note: The URI must start with "gs://". - string intent_batch_uri = 2; - - // The collection of intents to update or create. - IntentBatch intent_batch_inline = 3; - } - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The resource view to apply to the returned intent. - IntentView intent_view = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response message for [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2.Intents.BatchUpdateIntents]. -message BatchUpdateIntentsResponse { - // The collection of updated or created intents. - repeated Intent intents = 1; -} - -// The request message for [Intents.BatchDeleteIntents][google.cloud.dialogflow.v2.Intents.BatchDeleteIntents]. -message BatchDeleteIntentsRequest { - // Required. The name of the agent to delete all entities types for. Format: - // `projects//agent`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Intent" - } - ]; - - // Required. The collection of intents to delete. Only intent `name` must be - // filled in. - repeated Intent intents = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// This message is a wrapper around a collection of intents. -message IntentBatch { - // A collection of intents. - repeated Intent intents = 1; -} - -// Represents the options for views of an intent. -// An intent can be a sizable object. Therefore, we provide a resource view that -// does not return training phrases in the response by default. -enum IntentView { - // Training phrases field is not populated in the response. - INTENT_VIEW_UNSPECIFIED = 0; - - // All fields are populated. - INTENT_VIEW_FULL = 1; -} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/knowledge_base.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/knowledge_base.proto deleted file mode 100644 index 0b1aa8b3..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/knowledge_base.proto +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "KnowledgeBaseProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; - -// Service for managing [KnowledgeBases][google.cloud.dialogflow.v2.KnowledgeBase]. -service KnowledgeBases { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Returns the list of all knowledge bases of the specified agent. - rpc ListKnowledgeBases(ListKnowledgeBasesRequest) returns (ListKnowledgeBasesResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*}/knowledgeBases" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*}/knowledgeBases" - } - additional_bindings { - get: "/v2/{parent=projects/*/agent}/knowledgeBases" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves the specified knowledge base. - rpc GetKnowledgeBase(GetKnowledgeBaseRequest) returns (KnowledgeBase) { - option (google.api.http) = { - get: "/v2/{name=projects/*/knowledgeBases/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/knowledgeBases/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/agent/knowledgeBases/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a knowledge base. - rpc CreateKnowledgeBase(CreateKnowledgeBaseRequest) returns (KnowledgeBase) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/knowledgeBases" - body: "knowledge_base" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/knowledgeBases" - body: "knowledge_base" - } - additional_bindings { - post: "/v2/{parent=projects/*/agent}/knowledgeBases" - body: "knowledge_base" - } - }; - option (google.api.method_signature) = "parent,knowledge_base"; - } - - // Deletes the specified knowledge base. - rpc DeleteKnowledgeBase(DeleteKnowledgeBaseRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/knowledgeBases/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/knowledgeBases/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/agent/knowledgeBases/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Updates the specified knowledge base. - rpc UpdateKnowledgeBase(UpdateKnowledgeBaseRequest) returns (KnowledgeBase) { - option (google.api.http) = { - patch: "/v2/{knowledge_base.name=projects/*/knowledgeBases/*}" - body: "knowledge_base" - additional_bindings { - patch: "/v2/{knowledge_base.name=projects/*/locations/*/knowledgeBases/*}" - body: "knowledge_base" - } - additional_bindings { - patch: "/v2/{knowledge_base.name=projects/*/agent/knowledgeBases/*}" - body: "knowledge_base" - } - }; - option (google.api.method_signature) = "knowledge_base,update_mask"; - } -} - -// A knowledge base represents a collection of knowledge documents that you -// provide to Dialogflow. Your knowledge documents contain information that may -// be useful during conversations with end-users. Some Dialogflow features use -// knowledge bases when looking for a response to an end-user input. -// -// For more information, see the [knowledge base -// guide](https://cloud.google.com/dialogflow/docs/how/knowledge-bases). -// -// Note: The `projects.agent.knowledgeBases` resource is deprecated; -// only use `projects.knowledgeBases`. -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//locations//knowledgeBases/`. - string name = 1; - - // Required. The display name of the knowledge base. The name must be 1024 - // bytes or less; otherwise, the creation request fails. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Language which represents the KnowledgeBase. When the KnowledgeBase is - // created/updated, expect this to be present for non en-us languages. When - // unspecified, the default language code en-us applies. - string language_code = 4; -} - -// Request message for [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2.KnowledgeBases.ListKnowledgeBases]. -message ListKnowledgeBasesRequest { - // Required. The project to list of knowledge bases for. - // Format: `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/KnowledgeBase" - } - ]; - - // The maximum number of items to return in a single page. By - // default 10 and at most 100. - int32 page_size = 2; - - // The next_page_token value returned from a previous list request. - string page_token = 3; -} - -// Response message for [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2.KnowledgeBases.ListKnowledgeBases]. -message ListKnowledgeBasesResponse { - // The list of knowledge bases. - repeated KnowledgeBase knowledge_bases = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// Request message for [KnowledgeBases.GetKnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBases.GetKnowledgeBase]. -message GetKnowledgeBaseRequest { - // Required. The name of the knowledge base to retrieve. - // Format `projects//locations//knowledgeBases/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/KnowledgeBase" - } - ]; -} - -// Request message for [KnowledgeBases.CreateKnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBases.CreateKnowledgeBase]. -message CreateKnowledgeBaseRequest { - // Required. The project to create a knowledge base for. - // Format: `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/KnowledgeBase" - } - ]; - - // Required. The knowledge base to create. - KnowledgeBase knowledge_base = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for [KnowledgeBases.DeleteKnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBases.DeleteKnowledgeBase]. -message DeleteKnowledgeBaseRequest { - // Required. The name of the knowledge base to delete. - // Format: `projects//locations//knowledgeBases/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/KnowledgeBase" - } - ]; - - // Optional. Force deletes the knowledge base. When set to true, any documents - // in the knowledge base are also deleted. - bool force = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [KnowledgeBases.UpdateKnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBases.UpdateKnowledgeBase]. -message UpdateKnowledgeBaseRequest { - // Required. The knowledge base to update. - KnowledgeBase knowledge_base = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Not specified means `update all`. - // Currently, only `display_name` can be updated, an InvalidArgument will be - // returned for attempting to update other fields. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/participant.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/participant.proto deleted file mode 100644 index f815d819..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/participant.proto +++ /dev/null @@ -1,611 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dialogflow/v2/audio_config.proto"; -import "google/cloud/dialogflow/v2/session.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "ParticipantProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; - -// Service for managing [Participants][google.cloud.dialogflow.v2.Participant]. -service Participants { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Creates a new participant in a conversation. - rpc CreateParticipant(CreateParticipantRequest) returns (Participant) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/conversations/*}/participants" - body: "participant" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/conversations/*}/participants" - body: "participant" - } - }; - option (google.api.method_signature) = "parent,participant"; - } - - // Retrieves a conversation participant. - rpc GetParticipant(GetParticipantRequest) returns (Participant) { - option (google.api.http) = { - get: "/v2/{name=projects/*/conversations/*/participants/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/conversations/*/participants/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Returns the list of all participants in the specified conversation. - rpc ListParticipants(ListParticipantsRequest) returns (ListParticipantsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/conversations/*}/participants" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/conversations/*}/participants" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Updates the specified participant. - rpc UpdateParticipant(UpdateParticipantRequest) returns (Participant) { - option (google.api.http) = { - patch: "/v2/{participant.name=projects/*/conversations/*/participants/*}" - body: "participant" - additional_bindings { - patch: "/v2/{participant.name=projects/*/locations/*/conversations/*/participants/*}" - body: "participant" - } - }; - option (google.api.method_signature) = "participant,update_mask"; - } - - // Adds a text (chat, for example), or audio (phone recording, for example) - // message from a participant into the conversation. - // - // Note: Always use agent versions for production traffic - // sent to virtual agents. See [Versions and - // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). - rpc AnalyzeContent(AnalyzeContentRequest) returns (AnalyzeContentResponse) { - option (google.api.http) = { - post: "/v2/{participant=projects/*/conversations/*/participants/*}:analyzeContent" - body: "*" - additional_bindings { - post: "/v2/{participant=projects/*/locations/*/conversations/*/participants/*}:analyzeContent" - body: "*" - } - }; - option (google.api.method_signature) = "participant,text_input"; - option (google.api.method_signature) = "participant,event_input"; - } - - // Gets suggested articles for a participant based on specific historical - // messages. - rpc SuggestArticles(SuggestArticlesRequest) returns (SuggestArticlesResponse) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestArticles" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestArticles" - body: "*" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets suggested faq answers for a participant based on specific historical - // messages. - rpc SuggestFaqAnswers(SuggestFaqAnswersRequest) returns (SuggestFaqAnswersResponse) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers" - body: "*" - } - }; - option (google.api.method_signature) = "parent"; - } -} - -// Represents a conversation participant (human agent, virtual agent, end-user). -message Participant { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/Participant" - pattern: "projects/{project}/conversations/{conversation}/participants/{participant}" - pattern: "projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}" - }; - - // Enumeration of the roles a participant can play in a conversation. - enum Role { - // Participant role not set. - ROLE_UNSPECIFIED = 0; - - // Participant is a human agent. - HUMAN_AGENT = 1; - - // Participant is an automated agent, such as a Dialogflow agent. - AUTOMATED_AGENT = 2; - - // Participant is an end user that has called or chatted with - // Dialogflow services. - END_USER = 3; - } - - // Optional. The unique identifier of this participant. - // Format: `projects//locations//conversations//participants/`. - string name = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Immutable. The role this participant plays in the conversation. This field must be set - // during participant creation and is then immutable. - Role role = 2 [(google.api.field_behavior) = IMMUTABLE]; - - // Optional. Label applied to streams representing this participant in SIPREC - // XML metadata and SDP. This is used to assign transcriptions from that - // media stream to this participant. This field can be updated. - string sip_recording_media_label = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents a message posted into a conversation. -message Message { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/Message" - pattern: "projects/{project}/conversations/{conversation}/messages/{message}" - pattern: "projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}" - }; - - // The unique identifier of the message. - // Format: `projects//locations//conversations//messages/`. - string name = 1; - - // Required. The message content. - string content = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The message language. - // This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) - // language tag. Example: "en-US". - string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The participant that sends this message. - string participant = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The role of the participant. - Participant.Role participant_role = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the message was created. - google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The annotation for the message. - MessageAnnotation message_annotation = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The request message for [Participants.CreateParticipant][google.cloud.dialogflow.v2.Participants.CreateParticipant]. -message CreateParticipantRequest { - // Required. Resource identifier of the conversation adding the participant. - // Format: `projects//locations//conversations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Participant" - } - ]; - - // Required. The participant to create. - Participant participant = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [Participants.GetParticipant][google.cloud.dialogflow.v2.Participants.GetParticipant]. -message GetParticipantRequest { - // Required. The name of the participant. Format: - // `projects//locations//conversations//participants/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Participant" - } - ]; -} - -// The request message for [Participants.ListParticipants][google.cloud.dialogflow.v2.Participants.ListParticipants]. -message ListParticipantsRequest { - // Required. The conversation to list all participants from. - // Format: `projects//locations//conversations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Participant" - } - ]; - - // Optional. The maximum number of items to return in a single page. By - // default 100 and at most 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response message for [Participants.ListParticipants][google.cloud.dialogflow.v2.Participants.ListParticipants]. -message ListParticipantsResponse { - // The list of participants. There is a maximum number of items - // returned based on the page_size field in the request. - repeated Participant participants = 1; - - // Token to retrieve the next page of results or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request message for [Participants.UpdateParticipant][google.cloud.dialogflow.v2.Participants.UpdateParticipant]. -message UpdateParticipantRequest { - // Required. The participant to update. - Participant participant = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The mask to specify which fields to update. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent]. -message AnalyzeContentRequest { - // Required. The name of the participant this text comes from. - // Format: `projects//locations//conversations//participants/`. - string participant = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Participant" - } - ]; - - // Required. The input content. - oneof input { - // The natural language text to be processed. - TextInput text_input = 6; - - // An input event to send to Dialogflow. - EventInput event_input = 8; - } - - // Speech synthesis configuration. - // The speech synthesis settings for a virtual agent that may be configured - // for the associated conversation profile are not used when calling - // AnalyzeContent. If this configuration is not supplied, speech synthesis - // is disabled. - OutputAudioConfig reply_audio_config = 5; - - // Parameters for a Dialogflow virtual-agent query. - QueryParameters query_params = 9; - - // A unique identifier for this request. Restricted to 36 ASCII characters. - // A random UUID is recommended. - // This request is only idempotent if a `request_id` is provided. - string request_id = 11; -} - -// The message in the response that indicates the parameters of DTMF. -message DtmfParameters { - // Indicates whether DTMF input can be handled in the next request. - bool accepts_dtmf_input = 1; -} - -// The response message for [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent]. -message AnalyzeContentResponse { - // The output text content. - // This field is set if the automated agent responded with text to show to - // the user. - string reply_text = 1; - - // The audio data bytes encoded as specified in the request. - // This field is set if: - // - // - `reply_audio_config` was specified in the request, or - // - The automated agent responded with audio to play to the user. In such - // case, `reply_audio.config` contains settings used to synthesize the - // speech. - // - // In some scenarios, multiple output audio fields may be present in the - // response structure. In these cases, only the top-most-level audio output - // has content. - OutputAudio reply_audio = 2; - - // Only set if a Dialogflow automated agent has responded. - // Note that: [AutomatedAgentReply.detect_intent_response.output_audio][] - // and [AutomatedAgentReply.detect_intent_response.output_audio_config][] - // are always empty, use [reply_audio][google.cloud.dialogflow.v2.AnalyzeContentResponse.reply_audio] instead. - AutomatedAgentReply automated_agent_reply = 3; - - // Message analyzed by CCAI. - Message message = 5; - - // The suggestions for most recent human agent. The order is the same as - // [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.feature_configs] of - // [HumanAgentAssistantConfig.human_agent_suggestion_config][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.human_agent_suggestion_config]. - repeated SuggestionResult human_agent_suggestion_results = 6; - - // The suggestions for end user. The order is the same as - // [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.feature_configs] of - // [HumanAgentAssistantConfig.end_user_suggestion_config][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.end_user_suggestion_config]. - repeated SuggestionResult end_user_suggestion_results = 7; - - // Indicates the parameters of DTMF. - DtmfParameters dtmf_parameters = 9; -} - -// The request message for [Participants.SuggestArticles][google.cloud.dialogflow.v2.Participants.SuggestArticles]. -message SuggestArticlesRequest { - // Required. The name of the participant to fetch suggestion for. - // Format: `projects//locations//conversations//participants/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Participant" - } - ]; - - // The name of the latest conversation message to compile suggestion - // for. If empty, it will be the latest message of the conversation. - // - // Format: `projects//locations//conversations//messages/`. - string latest_message = 2 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Message" - }]; - - // Max number of messages prior to and including - // [latest_message][google.cloud.dialogflow.v2.SuggestArticlesRequest.latest_message] to use as context - // when compiling the suggestion. By default 20 and at most 50. - int32 context_size = 3; -} - -// The response message for [Participants.SuggestArticles][google.cloud.dialogflow.v2.Participants.SuggestArticles]. -message SuggestArticlesResponse { - // Articles ordered by score in descending order. - repeated ArticleAnswer article_answers = 1; - - // The name of the latest conversation message used to compile - // suggestion for. - // - // Format: `projects//locations//conversations//messages/`. - string latest_message = 2; - - // Number of messages prior to and including - // [latest_message][google.cloud.dialogflow.v2.SuggestArticlesResponse.latest_message] to compile the - // suggestion. It may be smaller than the - // [SuggestArticlesRequest.context_size][google.cloud.dialogflow.v2.SuggestArticlesRequest.context_size] field in the request if there - // aren't that many messages in the conversation. - int32 context_size = 3; -} - -// The request message for [Participants.SuggestFaqAnswers][google.cloud.dialogflow.v2.Participants.SuggestFaqAnswers]. -message SuggestFaqAnswersRequest { - // Required. The name of the participant to fetch suggestion for. - // Format: `projects//locations//conversations//participants/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Participant" - } - ]; - - // The name of the latest conversation message to compile suggestion - // for. If empty, it will be the latest message of the conversation. - // - // Format: `projects//locations//conversations//messages/`. - string latest_message = 2 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Message" - }]; - - // Max number of messages prior to and including - // [latest_message] to use as context when compiling the - // suggestion. By default 20 and at most 50. - int32 context_size = 3; -} - -// The request message for [Participants.SuggestFaqAnswers][google.cloud.dialogflow.v2.Participants.SuggestFaqAnswers]. -message SuggestFaqAnswersResponse { - // Answers extracted from FAQ documents. - repeated FaqAnswer faq_answers = 1; - - // The name of the latest conversation message used to compile - // suggestion for. - // - // Format: `projects//locations//conversations//messages/`. - string latest_message = 2; - - // Number of messages prior to and including - // [latest_message][google.cloud.dialogflow.v2.SuggestFaqAnswersResponse.latest_message] to compile the - // suggestion. It may be smaller than the - // [SuggestFaqAnswersRequest.context_size][google.cloud.dialogflow.v2.SuggestFaqAnswersRequest.context_size] field in the request if there - // aren't that many messages in the conversation. - int32 context_size = 3; -} - -// Represents the natural language speech audio to be played to the end user. -message OutputAudio { - // Instructs the speech synthesizer how to generate the speech - // audio. - OutputAudioConfig config = 1; - - // The natural language speech audio. - bytes audio = 2; -} - -// Represents a response from an automated agent. -message AutomatedAgentReply { - // Represents different automated agent reply types. - enum AutomatedAgentReplyType { - // Not specified. This should never happen. - AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED = 0; - - // Partial reply. e.g. Aggregated responses in a `Fulfillment` that enables - // `return_partial_response` can be returned as partial reply. - // WARNING: partial reply is not eligible for barge-in. - PARTIAL = 1; - - // Final reply. - FINAL = 2; - } - - // Response of the Dialogflow [Sessions.DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] call. - DetectIntentResponse detect_intent_response = 1; - - // AutomatedAgentReply type. - AutomatedAgentReplyType automated_agent_reply_type = 7; - - // Indicates whether the partial automated agent reply is interruptible when a - // later reply message arrives. e.g. if the agent specified some music as - // partial response, it can be cancelled. - bool allow_cancellation = 8; -} - -// Represents article answer. -message ArticleAnswer { - // The article title. - string title = 1; - - // The article URI. - string uri = 2; - - // Article snippets. - repeated string snippets = 3; - - // Article match confidence. - // The system's confidence score that this article is a good match for this - // conversation, as a value from 0.0 (completely uncertain) to 1.0 - // (completely certain). - float confidence = 4; - - // A map that contains metadata about the answer and the - // document from which it originates. - map metadata = 5; - - // The name of answer record, in the format of - // "projects//locations//answerRecords/" - string answer_record = 6; -} - -// Represents answer from "frequently asked questions". -message FaqAnswer { - // The piece of text from the `source` knowledge base document. - string answer = 1; - - // The system's confidence score that this Knowledge answer is a good match - // for this conversational query, range from 0.0 (completely uncertain) - // to 1.0 (completely certain). - float confidence = 2; - - // The corresponding FAQ question. - string question = 3; - - // Indicates which Knowledge Document this answer was extracted - // from. - // Format: `projects//locations//agent/knowledgeBases//documents/`. - string source = 4; - - // A map that contains metadata about the answer and the - // document from which it originates. - map metadata = 5; - - // The name of answer record, in the format of - // "projects//locations//answerRecords/" - string answer_record = 6; -} - -// One response of different type of suggestion response which is used in -// the response of [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] and -// [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent], as well as [HumanAgentAssistantEvent][google.cloud.dialogflow.v2.HumanAgentAssistantEvent]. -message SuggestionResult { - // Different type of suggestion response. - oneof suggestion_response { - // Error status if the request failed. - google.rpc.Status error = 1; - - // SuggestArticlesResponse if request is for ARTICLE_SUGGESTION. - SuggestArticlesResponse suggest_articles_response = 2; - - // SuggestFaqAnswersResponse if request is for FAQ_ANSWER. - SuggestFaqAnswersResponse suggest_faq_answers_response = 3; - } -} - -// Represents a part of a message possibly annotated with an entity. The part -// can be an entity or purely a part of the message between two entities or -// message start/end. -message AnnotatedMessagePart { - // A part of a message possibly annotated with an entity. - string text = 1; - - // The [Dialogflow system entity - // type](https://cloud.google.com/dialogflow/docs/reference/system-entities) - // of this message part. If this is empty, Dialogflow could not annotate the - // phrase part with a system entity. - string entity_type = 2; - - // The [Dialogflow system entity formatted value - // ](https://cloud.google.com/dialogflow/docs/reference/system-entities) of - // this message part. For example for a system entity of type - // `@sys.unit-currency`, this may contain: - //
-  // {
-  //   "amount": 5,
-  //   "currency": "USD"
-  // }
-  // 
- google.protobuf.Value formatted_value = 3; -} - -// Represents the result of annotation for the message. -message MessageAnnotation { - // The collection of annotated message parts ordered by their - // position in the message. You can recover the annotated message by - // concatenating [AnnotatedMessagePart.text]. - repeated AnnotatedMessagePart parts = 1; - - // Indicates whether the text message contains entities. - bool contain_entities = 2; -} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/session.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/session.proto deleted file mode 100644 index b4290f33..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/session.proto +++ /dev/null @@ -1,672 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dialogflow/v2/audio_config.proto"; -import "google/cloud/dialogflow/v2/context.proto"; -import "google/cloud/dialogflow/v2/intent.proto"; -import "google/cloud/dialogflow/v2/session_entity_type.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; -import "google/rpc/status.proto"; -import "google/type/latlng.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "SessionProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; -option (google.api.resource_definition) = { - type: "dialogflow.googleapis.com/Session" - pattern: "projects/{project}/agent/sessions/{session}" - pattern: "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}" - pattern: "projects/{project}/locations/{location}/agent/sessions/{session}" - pattern: "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}" -}; - -// A service used for session interactions. -// -// For more information, see the [API interactions -// guide](https://cloud.google.com/dialogflow/docs/api-overview). -service Sessions { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Processes a natural language query and returns structured, actionable data - // as a result. This method is not idempotent, because it may cause contexts - // and session entity types to be updated, which in turn might affect - // results of future queries. - // - // 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: "/v2/{session=projects/*/agent/sessions/*}:detectIntent" - body: "*" - additional_bindings { - post: "/v2/{session=projects/*/agent/environments/*/users/*/sessions/*}:detectIntent" - body: "*" - } - additional_bindings { - post: "/v2/{session=projects/*/locations/*/agent/sessions/*}:detectIntent" - body: "*" - } - additional_bindings { - post: "/v2/{session=projects/*/locations/*/agent/environments/*/users/*/sessions/*}:detectIntent" - body: "*" - } - }; - option (google.api.method_signature) = "session,query_input"; - } - - // 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) { - } -} - -// The request to detect user's intent. -message DetectIntentRequest { - // Required. The name of the session this query is sent to. Format: - // `projects//agent/sessions/`, or - // `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - // default 'draft' environment (`Environment ID` might be referred to as - // environment name at some places). If `User ID` is not specified, we are - // using "-". It's up to the API caller to choose an appropriate `Session ID` - // and `User Id`. They can be a random number or some type of user and session - // identifiers (preferably hashed). 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) = { - type: "dialogflow.googleapis.com/Session" - } - ]; - - // The parameters of this query. - QueryParameters query_params = 2; - - // Required. The input specification. It can be set to: - // - // 1. an audio config - // which instructs the speech recognizer how to process the speech audio, - // - // 2. a conversational query in the form of text, or - // - // 3. an event that specifies which intent to trigger. - QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; - - // Instructs the speech synthesizer how to generate the output - // audio. If this field is not set and agent-level speech synthesizer is not - // configured, no output audio is generated. - OutputAudioConfig output_audio_config = 4; - - // Mask for [output_audio_config][google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config] indicating which settings in this - // request-level config should override speech synthesizer settings defined at - // agent-level. - // - // If unspecified or empty, [output_audio_config][google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config] replaces the agent-level - // config in its entirety. - google.protobuf.FieldMask output_audio_config_mask = 7; - - // The natural language speech audio to be processed. This field - // should be populated iff `query_input` is set to an input audio config. - // A single request can contain up to 1 minute of speech audio data. - bytes input_audio = 5; -} - -// The message returned from the DetectIntent method. -message DetectIntentResponse { - // The unique identifier of the response. It can be used to - // locate a response in the training example set or for reporting issues. - string response_id = 1; - - // The selected results of the conversational query or event processing. - // See `alternative_query_results` for additional potential results. - QueryResult query_result = 2; - - // Specifies the status of the webhook request. - google.rpc.Status webhook_status = 3; - - // The audio data bytes encoded as specified in the request. - // Note: The output audio is generated based on the values of default platform - // text responses found in the `query_result.fulfillment_messages` field. If - // multiple default text responses exist, they will be concatenated when - // generating audio. If no default platform text responses exist, the - // generated audio content will be empty. - // - // In some scenarios, multiple output audio fields may be present in the - // response structure. In these cases, only the top-most-level audio output - // has content. - bytes output_audio = 4; - - // The config used by the speech synthesizer to generate the output audio. - OutputAudioConfig output_audio_config = 6; -} - -// Represents the parameters of the conversational query. -message QueryParameters { - // The time zone of this conversational query from the - // [time zone database](https://www.iana.org/time-zones), e.g., - // America/New_York, Europe/Paris. If not provided, the time zone specified in - // agent settings is used. - string time_zone = 1; - - // The geo location of this conversational query. - google.type.LatLng geo_location = 2; - - // The collection of contexts to be activated before this query is - // executed. - repeated Context contexts = 3; - - // Specifies whether to delete all contexts in the current session - // before the new ones are activated. - bool reset_contexts = 4; - - // Additional session entity types to replace or extend developer - // entity types with. The entity synonyms apply to all languages and persist - // for the session of this query. - repeated SessionEntityType session_entity_types = 5; - - // This field can be used to pass custom data to your webhook. - // Arbitrary JSON objects are supported. - // If supplied, the value is used to populate the - // `WebhookRequest.original_detect_intent_request.payload` - // field sent to your webhook. - google.protobuf.Struct payload = 6; - - // Configures the type of sentiment analysis to perform. If not - // provided, sentiment analysis is not performed. - SentimentAnalysisRequestConfig sentiment_analysis_request_config = 10; - - // This field can be used to pass HTTP headers for a webhook - // call. These headers will be sent to webhook along with the headers that - // have been configured through the Dialogflow web console. The headers - // defined within this field will overwrite the headers configured through the - // Dialogflow console if there is a conflict. Header names are - // case-insensitive. Google's specified headers are not allowed. Including: - // "Host", "Content-Length", "Connection", "From", "User-Agent", - // "Accept-Encoding", "If-Modified-Since", "If-None-Match", "X-Forwarded-For", - // etc. - map webhook_headers = 14; -} - -// Represents the query input. It can contain either: -// -// 1. An audio config which -// instructs the speech recognizer how to process the speech audio. -// -// 2. A conversational query in the form of text,. -// -// 3. An event that specifies which intent to trigger. -message QueryInput { - // Required. The input specification. - oneof input { - // Instructs the speech recognizer how to process the speech audio. - InputAudioConfig audio_config = 1; - - // The natural language text to be processed. - TextInput text = 2; - - // The event to be processed. - EventInput event = 3; - } -} - -// Represents the result of conversational query or event processing. -message QueryResult { - // The original conversational query text: - // - // - If natural language text was provided as input, `query_text` contains - // a copy of the input. - // - If natural language speech audio was provided as input, `query_text` - // contains the speech recognition result. If speech recognizer produced - // multiple alternatives, a particular one is picked. - // - If automatic spell correction is enabled, `query_text` will contain the - // corrected user input. - string query_text = 1; - - // The language that was triggered during intent detection. - // See [Language - // Support](https://cloud.google.com/dialogflow/docs/reference/language) - // for a list of the currently supported language codes. - string language_code = 15; - - // The Speech recognition confidence between 0.0 and 1.0. A higher number - // indicates an estimated greater likelihood that the recognized words are - // correct. The default of 0.0 is a sentinel value indicating that confidence - // was not set. - // - // This field is not guaranteed to be accurate or set. In particular this - // field isn't set for StreamingDetectIntent since the streaming endpoint has - // separate confidence estimates per portion of the audio in - // StreamingRecognitionResult. - float speech_recognition_confidence = 2; - - // The action name from the matched intent. - string action = 3; - - // The collection of extracted parameters. - // - // Depending on your protocol or client library language, this is a - // map, associative array, symbol table, dictionary, or JSON object - // composed of a collection of (MapKey, MapValue) pairs: - // - // - MapKey type: string - // - MapKey value: parameter name - // - MapValue type: - // - If parameter's entity type is a composite entity: map - // - Else: depending on parameter value type, could be one of string, - // number, boolean, null, list or map - // - MapValue value: - // - If parameter's entity type is a composite entity: - // map from composite entity property names to property values - // - Else: parameter value - google.protobuf.Struct parameters = 4; - - // This field is set to: - // - // - `false` if the matched intent has required parameters and not all of - // the required parameter values have been collected. - // - `true` if all required parameter values have been collected, or if the - // matched intent doesn't contain any required parameters. - bool all_required_params_present = 5; - - // Indicates whether the conversational query triggers a cancellation for slot - // filling. - bool cancels_slot_filling = 21; - - // The text to be pronounced to the user or shown on the screen. - // Note: This is a legacy field, `fulfillment_messages` should be preferred. - string fulfillment_text = 6; - - // The collection of rich messages to present to the user. - repeated Intent.Message fulfillment_messages = 7; - - // If the query was fulfilled by a webhook call, this field is set to the - // value of the `source` field returned in the webhook response. - string webhook_source = 8; - - // If the query was fulfilled by a webhook call, this field is set to the - // value of the `payload` field returned in the webhook response. - google.protobuf.Struct webhook_payload = 9; - - // The collection of output contexts. If applicable, - // `output_contexts.parameters` contains entries with name - // `.original` containing the original parameter values - // before the query. - repeated Context output_contexts = 10; - - // The intent that matched the conversational query. Some, not - // all fields are filled in this message, including but not limited to: - // `name`, `display_name`, `end_interaction` and `is_fallback`. - Intent intent = 11; - - // The intent detection confidence. Values range from 0.0 - // (completely uncertain) to 1.0 (completely certain). - // This value is for informational purpose only and is only used to - // help match the best intent within the classification threshold. - // This value may change for the same end-user expression at any time due to a - // model retraining or change in implementation. - // If there are `multiple knowledge_answers` messages, this value is set to - // the greatest `knowledgeAnswers.match_confidence` value in the list. - float intent_detection_confidence = 12; - - // Free-form diagnostic information for the associated detect intent request. - // The fields of this data can change without notice, so you should not write - // code that depends on its structure. - // The data may contain: - // - // - webhook call latency - // - webhook errors - google.protobuf.Struct diagnostic_info = 14; - - // The sentiment analysis result, which depends on the - // `sentiment_analysis_request_config` specified in the request. - SentimentAnalysisResult sentiment_analysis_result = 17; -} - -// The top-level message sent by the client to the -// [Sessions.StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent] method. -// -// Multiple request messages should be sent in order: -// -// 1. The first message must contain -// [session][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.session], -// [query_input][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input] plus optionally -// [query_params][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_params]. If the client -// wants to receive an audio response, it should also contain -// [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config]. -// The message must not contain -// [input_audio][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio]. -// 2. If [query_input][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input] was set to -// [query_input.audio_config][google.cloud.dialogflow.v2.InputAudioConfig], all subsequent -// messages must contain -// [input_audio][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio] to continue with -// Speech recognition. -// If you decide to rather detect an intent from text input after you -// already started Speech recognition, please send a message with -// [query_input.text][google.cloud.dialogflow.v2.QueryInput.text]. -// -// However, note that: -// -// * Dialogflow will bill you for the audio duration so far. -// * Dialogflow discards all Speech recognition results in favor of the -// input text. -// * Dialogflow will use the language code from the first message. -// -// After you sent all input, you must half-close or abort the request stream. -message StreamingDetectIntentRequest { - // Required. The name of the session the query is sent to. - // Format of the session name: - // `projects//agent/sessions/`, or - // `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - // default 'draft' environment. If `User ID` is not specified, we are using - // "-". It's up to the API caller to choose an appropriate `Session ID` and - // `User Id`. They can be a random number or some type of user and session - // identifiers (preferably hashed). 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) = { - type: "dialogflow.googleapis.com/Session" - } - ]; - - // The parameters of this query. - QueryParameters query_params = 2; - - // Required. The input specification. It can be set to: - // - // 1. an audio config which instructs the speech recognizer how to process - // the speech audio, - // - // 2. a conversational query in the form of text, or - // - // 3. an event that specifies which intent to trigger. - QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; - - // Please use [InputAudioConfig.single_utterance][google.cloud.dialogflow.v2.InputAudioConfig.single_utterance] instead. - // If `false` (default), recognition does not cease until - // the client closes the stream. If `true`, the recognizer will detect a - // single spoken utterance in input audio. Recognition ceases when it detects - // the audio's voice has stopped or paused. In this case, once a detected - // intent is received, the client should close the stream and start a new - // request with a new stream as needed. - // This setting is ignored when `query_input` is a piece of text or an event. - bool single_utterance = 4 [deprecated = true]; - - // Instructs the speech synthesizer how to generate the output - // audio. If this field is not set and agent-level speech synthesizer is not - // configured, no output audio is generated. - OutputAudioConfig output_audio_config = 5; - - // Mask for [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config] indicating which settings in this - // request-level config should override speech synthesizer settings defined at - // agent-level. - // - // If unspecified or empty, [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config] replaces the agent-level - // config in its entirety. - google.protobuf.FieldMask output_audio_config_mask = 7; - - // The input audio content to be recognized. Must be sent if - // `query_input` was set to a streaming input audio config. The complete audio - // over all streaming messages must not exceed 1 minute. - bytes input_audio = 6; -} - -// The top-level message returned from the -// `StreamingDetectIntent` method. -// -// Multiple response messages can be returned in order: -// -// 1. If the input was set to streaming audio, the first one or more messages -// contain `recognition_result`. Each `recognition_result` represents a more -// complete transcript of what the user said. The last `recognition_result` -// has `is_final` set to `true`. -// -// 2. The next message contains `response_id`, `query_result` -// and optionally `webhook_status` if a WebHook was called. -message StreamingDetectIntentResponse { - // The unique identifier of the response. It can be used to - // locate a response in the training example set or for reporting issues. - string response_id = 1; - - // The result of speech recognition. - StreamingRecognitionResult recognition_result = 2; - - // The result of the conversational query or event processing. - QueryResult query_result = 3; - - // Specifies the status of the webhook request. - google.rpc.Status webhook_status = 4; - - // The audio data bytes encoded as specified in the request. - // Note: The output audio is generated based on the values of default platform - // text responses found in the `query_result.fulfillment_messages` field. If - // multiple default text responses exist, they will be concatenated when - // generating audio. If no default platform text responses exist, the - // generated audio content will be empty. - // - // In some scenarios, multiple output audio fields may be present in the - // response structure. In these cases, only the top-most-level audio output - // has content. - bytes output_audio = 5; - - // The config used by the speech synthesizer to generate the output audio. - OutputAudioConfig output_audio_config = 6; -} - -// Contains a speech recognition result corresponding to a portion of the audio -// that is currently being processed or an indication that this is the end -// of the single requested utterance. -// -// Example: -// -// 1. transcript: "tube" -// -// 2. transcript: "to be a" -// -// 3. transcript: "to be" -// -// 4. transcript: "to be or not to be" -// is_final: true -// -// 5. transcript: " that's" -// -// 6. transcript: " that is" -// -// 7. message_type: `END_OF_SINGLE_UTTERANCE` -// -// 8. transcript: " that is the question" -// is_final: true -// -// Only two of the responses contain final results (#4 and #8 indicated by -// `is_final: true`). Concatenating these generates the full transcript: "to be -// or not to be that is the question". -// -// In each response we populate: -// -// * for `TRANSCRIPT`: `transcript` and possibly `is_final`. -// -// * for `END_OF_SINGLE_UTTERANCE`: only `message_type`. -message StreamingRecognitionResult { - // Type of the response message. - enum MessageType { - // Not specified. Should never be used. - MESSAGE_TYPE_UNSPECIFIED = 0; - - // Message contains a (possibly partial) transcript. - TRANSCRIPT = 1; - - // Event indicates that the server has detected the end of the user's speech - // utterance and expects no additional inputs. - // Therefore, the server will not process additional audio (although it may subsequently return additional results). The - // client should stop sending additional audio data, half-close the gRPC - // connection, and wait for any additional results until the server closes - // the gRPC connection. This message is only sent if `single_utterance` was - // set to `true`, and is not used otherwise. - END_OF_SINGLE_UTTERANCE = 2; - } - - // Type of the result message. - MessageType message_type = 1; - - // Transcript text representing the words that the user spoke. - // Populated if and only if `message_type` = `TRANSCRIPT`. - string transcript = 2; - - // If `false`, the `StreamingRecognitionResult` represents an - // interim result that may change. If `true`, the recognizer will not return - // any further hypotheses about this piece of the audio. May only be populated - // for `message_type` = `TRANSCRIPT`. - bool is_final = 3; - - // The Speech confidence between 0.0 and 1.0 for the current portion of audio. - // A higher number indicates an estimated greater likelihood that the - // recognized words are correct. The default of 0.0 is a sentinel value - // indicating that confidence was not set. - // - // This field is typically only provided if `is_final` is true and you should - // not rely on it being accurate or even set. - float confidence = 4; - - // Word-specific information for the words recognized by Speech in - // [transcript][google.cloud.dialogflow.v2.StreamingRecognitionResult.transcript]. Populated if and only if `message_type` = `TRANSCRIPT` and - // [InputAudioConfig.enable_word_info] is set. - repeated SpeechWordInfo speech_word_info = 7; - - // Time offset of the end of this Speech recognition result relative to the - // beginning of the audio. Only populated for `message_type` = `TRANSCRIPT`. - google.protobuf.Duration speech_end_offset = 8; - - // Detected language code for the transcript. - string language_code = 10; -} - -// Represents the natural language text to be processed. -message TextInput { - // Required. The UTF-8 encoded natural language text to be processed. - // Text length must not exceed 256 characters. - string text = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The language of this conversational query. See [Language - // Support](https://cloud.google.com/dialogflow/docs/reference/language) - // for a list of the currently supported language codes. Note that queries in - // the same session do not necessarily need to specify the same language. - string language_code = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Events allow for matching intents by event name instead of the natural -// language input. For instance, input `` can trigger a personalized welcome response. -// The parameter `name` may be used by the agent in the response: -// `"Hello #welcome_event.name! What can I do for you today?"`. -message EventInput { - // Required. The unique identifier of the event. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // The collection of parameters associated with the event. - // - // Depending on your protocol or client library language, this is a - // map, associative array, symbol table, dictionary, or JSON object - // composed of a collection of (MapKey, MapValue) pairs: - // - // - MapKey type: string - // - MapKey value: parameter name - // - MapValue type: - // - If parameter's entity type is a composite entity: map - // - Else: depending on parameter value type, could be one of string, - // number, boolean, null, list or map - // - MapValue value: - // - If parameter's entity type is a composite entity: - // map from composite entity property names to property values - // - Else: parameter value - google.protobuf.Struct parameters = 2; - - // Required. The language of this query. See [Language - // Support](https://cloud.google.com/dialogflow/docs/reference/language) - // for a list of the currently supported language codes. Note that queries in - // the same session do not necessarily need to specify the same language. - string language_code = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Configures the types of sentiment analysis to perform. -message SentimentAnalysisRequestConfig { - // Instructs the service to perform sentiment analysis on - // `query_text`. If not provided, sentiment analysis is not performed on - // `query_text`. - bool analyze_query_text_sentiment = 1; -} - -// The result of sentiment analysis. Sentiment analysis inspects user input -// and identifies the prevailing subjective opinion, especially to determine a -// user's attitude as positive, negative, or neutral. -// For [Participants.DetectIntent][], it needs to be configured in -// [DetectIntentRequest.query_params][google.cloud.dialogflow.v2.DetectIntentRequest.query_params]. For -// [Participants.StreamingDetectIntent][], it needs to be configured in -// [StreamingDetectIntentRequest.query_params][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_params]. -// And for [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] and -// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent], it needs to be configured in -// [ConversationProfile.human_agent_assistant_config][google.cloud.dialogflow.v2.ConversationProfile.human_agent_assistant_config] -message SentimentAnalysisResult { - // The sentiment analysis result for `query_text`. - Sentiment query_text_sentiment = 1; -} - -// The sentiment, such as positive/negative feeling or association, for a unit -// of analysis, such as the query text. -message Sentiment { - // Sentiment score between -1.0 (negative sentiment) and 1.0 (positive - // sentiment). - float score = 1; - - // A non-negative number in the [0, +inf) range, which represents the absolute - // magnitude of sentiment, regardless of score (positive or negative). - float magnitude = 2; -} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/session_entity_type.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/session_entity_type.proto deleted file mode 100644 index 44efa779..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/session_entity_type.proto +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dialogflow/v2/entity_type.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "SessionEntityTypeProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; - -// Service for managing [SessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityType]. -service SessionEntityTypes { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Returns the list of all session entity types in the specified session. - // - // This method doesn't work with Google Assistant integration. - // Contact Dialogflow support if you need to use session entities - // with Google Assistant integration. - rpc ListSessionEntityTypes(ListSessionEntityTypesRequest) returns (ListSessionEntityTypesResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/agent/sessions/*}/entityTypes" - additional_bindings { - get: "/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes" - } - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/agent/sessions/*}/entityTypes" - } - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves the specified session entity type. - // - // This method doesn't work with Google Assistant integration. - // Contact Dialogflow support if you need to use session entities - // with Google Assistant integration. - rpc GetSessionEntityType(GetSessionEntityTypeRequest) returns (SessionEntityType) { - option (google.api.http) = { - get: "/v2/{name=projects/*/agent/sessions/*/entityTypes/*}" - additional_bindings { - get: "/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a session entity type. - // - // If the specified session entity type already exists, overrides the session - // entity type. - // - // This method doesn't work with Google Assistant integration. - // Contact Dialogflow support if you need to use session entities - // with Google Assistant integration. - rpc CreateSessionEntityType(CreateSessionEntityTypeRequest) returns (SessionEntityType) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/agent/sessions/*}/entityTypes" - body: "session_entity_type" - additional_bindings { - post: "/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes" - body: "session_entity_type" - } - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/agent/sessions/*}/entityTypes" - body: "session_entity_type" - } - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes" - body: "session_entity_type" - } - }; - option (google.api.method_signature) = "parent,session_entity_type"; - } - - // Updates the specified session entity type. - // - // This method doesn't work with Google Assistant integration. - // Contact Dialogflow support if you need to use session entities - // with Google Assistant integration. - rpc UpdateSessionEntityType(UpdateSessionEntityTypeRequest) returns (SessionEntityType) { - option (google.api.http) = { - patch: "/v2/{session_entity_type.name=projects/*/agent/sessions/*/entityTypes/*}" - body: "session_entity_type" - additional_bindings { - patch: "/v2/{session_entity_type.name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" - body: "session_entity_type" - } - additional_bindings { - patch: "/v2/{session_entity_type.name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" - body: "session_entity_type" - } - additional_bindings { - patch: "/v2/{session_entity_type.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" - body: "session_entity_type" - } - }; - option (google.api.method_signature) = "session_entity_type"; - option (google.api.method_signature) = "session_entity_type,update_mask"; - } - - // Deletes the specified session entity type. - // - // This method doesn't work with Google Assistant integration. - // Contact Dialogflow support if you need to use session entities - // with Google Assistant integration. - rpc DeleteSessionEntityType(DeleteSessionEntityTypeRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/agent/sessions/*/entityTypes/*}" - additional_bindings { - delete: "/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" - } - }; - option (google.api.method_signature) = "name"; - } -} - -// A session represents a conversation between a Dialogflow agent and an -// end-user. You can create special entities, called session entities, during a -// session. Session entities can extend or replace custom entity types and only -// exist during the session that they were created for. All session data, -// including session entities, is stored by Dialogflow for 20 minutes. -// -// For more information, see the [session entity -// guide](https://cloud.google.com/dialogflow/docs/entities-session). -message SessionEntityType { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/SessionEntityType" - pattern: "projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}" - pattern: "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}" - pattern: "projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}" - pattern: "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}" - }; - - // The types of modifications for a session entity type. - enum EntityOverrideMode { - // Not specified. This value should be never used. - ENTITY_OVERRIDE_MODE_UNSPECIFIED = 0; - - // The collection of session entities overrides the collection of entities - // in the corresponding custom entity type. - ENTITY_OVERRIDE_MODE_OVERRIDE = 1; - - // The collection of session entities extends the collection of entities in - // the corresponding custom entity type. - // - // Note: Even in this override mode calls to `ListSessionEntityTypes`, - // `GetSessionEntityType`, `CreateSessionEntityType` and - // `UpdateSessionEntityType` only return the additional entities added in - // this session entity type. If you want to get the supplemented list, - // please call [EntityTypes.GetEntityType][google.cloud.dialogflow.v2.EntityTypes.GetEntityType] on the custom entity type - // and merge. - ENTITY_OVERRIDE_MODE_SUPPLEMENT = 2; - } - - // Required. The unique identifier of this session entity type. Format: - // `projects//agent/sessions//entityTypes/`, or `projects//agent/environments//users//sessions//entityTypes/`. - // If `Environment ID` is not specified, we assume default 'draft' - // environment. If `User ID` is not specified, we assume default '-' user. - // - // `` must be the display name of an existing entity - // type in the same agent that will be overridden or supplemented. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Indicates whether the additional data should override or - // supplement the custom entity type definition. - EntityOverrideMode entity_override_mode = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The collection of entities associated with this session entity - // type. - repeated EntityType.Entity entities = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes]. -message ListSessionEntityTypesRequest { - // Required. The session to list all session entity types from. - // Format: `projects//agent/sessions/` or - // `projects//agent/environments//users// - // sessions/`. - // If `Environment ID` is not specified, we assume default 'draft' - // environment. If `User ID` is not specified, we assume default '-' user. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/SessionEntityType" - } - ]; - - // Optional. The maximum number of items to return in a single page. By - // default 100 and at most 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes]. -message ListSessionEntityTypesResponse { - // The list of session entity types. There will be a maximum number of items - // returned based on the page_size field in the request. - repeated SessionEntityType session_entity_types = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request message for [SessionEntityTypes.GetSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.GetSessionEntityType]. -message GetSessionEntityTypeRequest { - // Required. The name of the session entity type. Format: - // `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. - // If `Environment ID` is not specified, we assume default 'draft' - // environment. If `User ID` is not specified, we assume default '-' user. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/SessionEntityType" - } - ]; -} - -// The request message for [SessionEntityTypes.CreateSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.CreateSessionEntityType]. -message CreateSessionEntityTypeRequest { - // Required. The session to create a session entity type for. - // Format: `projects//agent/sessions/` or - // `projects//agent/environments//users// - // sessions/`. - // If `Environment ID` is not specified, we assume default 'draft' - // environment. If `User ID` is not specified, we assume default '-' user. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/SessionEntityType" - } - ]; - - // Required. The session entity type to create. - SessionEntityType session_entity_type = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [SessionEntityTypes.UpdateSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.UpdateSessionEntityType]. -message UpdateSessionEntityTypeRequest { - // Required. The session entity type to update. - SessionEntityType session_entity_type = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [SessionEntityTypes.DeleteSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.DeleteSessionEntityType]. -message DeleteSessionEntityTypeRequest { - // Required. The name of the entity type to delete. Format: - // `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. - // If `Environment ID` is not specified, we assume default 'draft' - // environment. If `User ID` is not specified, we assume default '-' user. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/SessionEntityType" - } - ]; -} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/validation_result.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/validation_result.proto deleted file mode 100644 index 5b8d2780..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/validation_result.proto +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/api/annotations.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "ValidationResultProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; - -// Represents a single validation error. -message ValidationError { - // Represents a level of severity. - enum Severity { - // Not specified. This value should never be used. - SEVERITY_UNSPECIFIED = 0; - - // The agent doesn't follow Dialogflow best practices. - INFO = 1; - - // The agent may not behave as expected. - WARNING = 2; - - // The agent may experience partial failures. - ERROR = 3; - - // The agent may completely fail. - CRITICAL = 4; - } - - // The severity of the error. - Severity severity = 1; - - // The names of the entries that the error is associated with. - // Format: - // - // - "projects//agent", if the error is associated with the entire - // agent. - // - "projects//agent/intents/", if the error is - // associated with certain intents. - // - "projects//agent/intents//trainingPhrases/", if the - // error is associated with certain intent training phrases. - // - "projects//agent/intents//parameters/", if the error is associated with certain intent parameters. - // - "projects//agent/entities/", if the error is - // associated with certain entities. - repeated string entries = 3; - - // The detailed error message. - string error_message = 4; -} - -// Represents the output of agent validation. -message ValidationResult { - // Contains all validation errors. - repeated ValidationError validation_errors = 1; -} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/version.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/version.proto deleted file mode 100644 index 8e8c0011..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/version.proto +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "VersionProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; - -// Service for managing [Versions][google.cloud.dialogflow.v2.Version]. -service Versions { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Returns the list of all versions of the specified agent. - rpc ListVersions(ListVersionsRequest) returns (ListVersionsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/agent}/versions" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/agent}/versions" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves the specified agent version. - rpc GetVersion(GetVersionRequest) returns (Version) { - option (google.api.http) = { - get: "/v2/{name=projects/*/agent/versions/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/agent/versions/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates an agent version. - // - // The new version points to the agent instance in the "default" environment. - rpc CreateVersion(CreateVersionRequest) returns (Version) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/agent}/versions" - body: "version" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/agent}/versions" - body: "version" - } - }; - option (google.api.method_signature) = "parent,version"; - } - - // Updates the specified agent version. - // - // Note that this method does not allow you to update the state of the agent - // the given version points to. It allows you to update only mutable - // properties of the version resource. - rpc UpdateVersion(UpdateVersionRequest) returns (Version) { - option (google.api.http) = { - patch: "/v2/{version.name=projects/*/agent/versions/*}" - body: "version" - additional_bindings { - patch: "/v2/{version.name=projects/*/locations/*/agent/versions/*}" - body: "version" - } - }; - option (google.api.method_signature) = "version,update_mask"; - } - - // Delete the specified agent version. - rpc DeleteVersion(DeleteVersionRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/agent/versions/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/agent/versions/*}" - } - }; - option (google.api.method_signature) = "name"; - } -} - -// You can create multiple versions of your agent and publish them to separate -// environments. -// -// When you edit an agent, you are editing the draft agent. At any point, you -// can save the draft agent as an agent version, which is an immutable snapshot -// of your agent. -// -// When you save the draft agent, it is published to the default environment. -// When you create agent versions, you can publish them to custom environments. -// You can create a variety of custom environments for: -// -// - testing -// - development -// - production -// - etc. -// -// For more information, see the [versions and environments -// guide](https://cloud.google.com/dialogflow/docs/agents-versions). -message Version { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/Version" - pattern: "projects/{project}/agent/versions/{version}" - pattern: "projects/{project}/locations/{location}/agent/versions/{version}" - }; - - // The status of a version. - enum VersionStatus { - // Not specified. This value is not used. - VERSION_STATUS_UNSPECIFIED = 0; - - // Version is not ready to serve (e.g. training is in progress). - IN_PROGRESS = 1; - - // Version is ready to serve. - READY = 2; - - // Version training failed. - FAILED = 3; - } - - // Output only. The unique identifier of this agent version. - // Supported formats: - // - // - `projects//agent/versions/` - // - `projects//locations//agent/versions/` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The developer-provided description of this version. - string description = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The sequential number of this version. This field is read-only which means - // it cannot be set by create and update methods. - int32 version_number = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The creation time of this version. This field is read-only, i.e., it cannot - // be set by create and update methods. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The status of this version. This field is read-only and cannot be set by - // create and update methods. - VersionStatus status = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The request message for [Versions.ListVersions][google.cloud.dialogflow.v2.Versions.ListVersions]. -message ListVersionsRequest { - // Required. The agent to list all versions from. - // Supported formats: - // - // - `projects//agent` - // - `projects//locations//agent` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Version" - } - ]; - - // Optional. The maximum number of items to return in a single page. By default 100 and - // at most 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response message for [Versions.ListVersions][google.cloud.dialogflow.v2.Versions.ListVersions]. -message ListVersionsResponse { - // The list of agent versions. There will be a maximum number of items - // returned based on the page_size field in the request. - repeated Version versions = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request message for [Versions.GetVersion][google.cloud.dialogflow.v2.Versions.GetVersion]. -message GetVersionRequest { - // Required. The name of the version. - // Supported formats: - // - // - `projects//agent/versions/` - // - `projects//locations//agent/versions/` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Version" - } - ]; -} - -// The request message for [Versions.CreateVersion][google.cloud.dialogflow.v2.Versions.CreateVersion]. -message CreateVersionRequest { - // Required. The agent to create a version for. - // Supported formats: - // - // - `projects//agent` - // - `projects//locations//agent` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Version" - } - ]; - - // Required. The version to create. - Version version = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [Versions.UpdateVersion][google.cloud.dialogflow.v2.Versions.UpdateVersion]. -message UpdateVersionRequest { - // Required. The version to update. - // Supported formats: - // - // - `projects//agent/versions/` - // - `projects//locations//agent/versions/` - Version version = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [Versions.DeleteVersion][google.cloud.dialogflow.v2.Versions.DeleteVersion]. -message DeleteVersionRequest { - // Required. The name of the version to delete. - // Supported formats: - // - // - `projects//agent/versions/` - // - `projects//locations//agent/versions/` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Version" - } - ]; -} diff --git a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/webhook.proto b/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/webhook.proto deleted file mode 100644 index ce72e92d..00000000 --- a/owl-bot-staging/v2/protos/google/cloud/dialogflow/v2/webhook.proto +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2; - -import "google/cloud/dialogflow/v2/context.proto"; -import "google/cloud/dialogflow/v2/intent.proto"; -import "google/cloud/dialogflow/v2/session.proto"; -import "google/cloud/dialogflow/v2/session_entity_type.proto"; -import "google/protobuf/struct.proto"; -import "google/api/annotations.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "WebhookProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; - -// The request message for a webhook call. -message WebhookRequest { - // The unique identifier of detectIntent request session. - // Can be used to identify end-user inside webhook implementation. - // Format: `projects//agent/sessions/`, or - // `projects//agent/environments//users//sessions/`. - string session = 4; - - // The unique identifier of the response. Contains the same value as - // `[Streaming]DetectIntentResponse.response_id`. - string response_id = 1; - - // The result of the conversational query or event processing. Contains the - // same value as `[Streaming]DetectIntentResponse.query_result`. - QueryResult query_result = 2; - - // Optional. The contents of the original request that was passed to - // `[Streaming]DetectIntent` call. - OriginalDetectIntentRequest original_detect_intent_request = 3; -} - -// The response message for a webhook call. -// -// This response is validated by the Dialogflow server. If validation fails, -// an error will be returned in the [QueryResult.diagnostic_info][google.cloud.dialogflow.v2.QueryResult.diagnostic_info] field. -// Setting JSON fields to an empty value with the wrong type is a common error. -// To avoid this error: -// -// - Use `""` for empty strings -// - Use `{}` or `null` for empty objects -// - Use `[]` or `null` for empty arrays -// -// For more information, see the -// [Protocol Buffers Language -// Guide](https://developers.google.com/protocol-buffers/docs/proto3#json). -message WebhookResponse { - // Optional. The text response message intended for the end-user. - // It is recommended to use `fulfillment_messages.text.text[0]` instead. - // When provided, Dialogflow uses this field to populate - // [QueryResult.fulfillment_text][google.cloud.dialogflow.v2.QueryResult.fulfillment_text] sent to the integration or API caller. - string fulfillment_text = 1; - - // Optional. The rich response messages intended for the end-user. - // When provided, Dialogflow uses this field to populate - // [QueryResult.fulfillment_messages][google.cloud.dialogflow.v2.QueryResult.fulfillment_messages] sent to the integration or API caller. - repeated Intent.Message fulfillment_messages = 2; - - // Optional. A custom field used to identify the webhook source. - // Arbitrary strings are supported. - // When provided, Dialogflow uses this field to populate - // [QueryResult.webhook_source][google.cloud.dialogflow.v2.QueryResult.webhook_source] sent to the integration or API caller. - string source = 3; - - // Optional. This field can be used to pass custom data from your webhook to the - // integration or API caller. Arbitrary JSON objects are supported. - // When provided, Dialogflow uses this field to populate - // [QueryResult.webhook_payload][google.cloud.dialogflow.v2.QueryResult.webhook_payload] sent to the integration or API caller. - // This field is also used by the - // [Google Assistant - // integration](https://cloud.google.com/dialogflow/docs/integrations/aog) - // for rich response messages. - // See the format definition at [Google Assistant Dialogflow webhook - // format](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json) - google.protobuf.Struct payload = 4; - - // Optional. The collection of output contexts that will overwrite currently - // active contexts for the session and reset their lifespans. - // When provided, Dialogflow uses this field to populate - // [QueryResult.output_contexts][google.cloud.dialogflow.v2.QueryResult.output_contexts] sent to the integration or API caller. - repeated Context output_contexts = 5; - - // Optional. Invokes the supplied events. - // When this field is set, Dialogflow ignores the `fulfillment_text`, - // `fulfillment_messages`, and `payload` fields. - EventInput followup_event_input = 6; - - // Optional. Additional session entity types to replace or extend developer - // entity types with. The entity synonyms apply to all languages and persist - // for the session. Setting this data from a webhook overwrites - // the session entity types that have been set using `detectIntent`, - // `streamingDetectIntent` or [SessionEntityType][google.cloud.dialogflow.v2.SessionEntityType] management methods. - repeated SessionEntityType session_entity_types = 10; -} - -// Represents the contents of the original request that was passed to -// the `[Streaming]DetectIntent` call. -message OriginalDetectIntentRequest { - // The source of this request, e.g., `google`, `facebook`, `slack`. It is set - // by Dialogflow-owned servers. - string source = 1; - - // Optional. The version of the protocol used for this request. - // This field is AoG-specific. - string version = 2; - - // Optional. This field is set to the value of the `QueryParameters.payload` - // field passed in the request. Some integrations that query a Dialogflow - // agent may provide additional information in the payload. - // - // In particular, for the Dialogflow Phone Gateway integration, this field has - // the form: - //
{
-  //  "telephony": {
-  //    "caller_id": "+18558363987"
-  //  }
-  // }
- // Note: The caller ID field (`caller_id`) will be redacted for Trial - // Edition agents and populated with the caller ID in [E.164 - // format](https://en.wikipedia.org/wiki/E.164) for Essentials Edition agents. - google.protobuf.Struct payload = 3; -} diff --git a/owl-bot-staging/v2/src/index.ts b/owl-bot-staging/v2/src/index.ts deleted file mode 100644 index dd1e9ab7..00000000 --- a/owl-bot-staging/v2/src/index.ts +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v2 from './v2'; -const AgentsClient = v2.AgentsClient; -type AgentsClient = v2.AgentsClient; -const AnswerRecordsClient = v2.AnswerRecordsClient; -type AnswerRecordsClient = v2.AnswerRecordsClient; -const ContextsClient = v2.ContextsClient; -type ContextsClient = v2.ContextsClient; -const ConversationProfilesClient = v2.ConversationProfilesClient; -type ConversationProfilesClient = v2.ConversationProfilesClient; -const ConversationsClient = v2.ConversationsClient; -type ConversationsClient = v2.ConversationsClient; -const DocumentsClient = v2.DocumentsClient; -type DocumentsClient = v2.DocumentsClient; -const EntityTypesClient = v2.EntityTypesClient; -type EntityTypesClient = v2.EntityTypesClient; -const EnvironmentsClient = v2.EnvironmentsClient; -type EnvironmentsClient = v2.EnvironmentsClient; -const FulfillmentsClient = v2.FulfillmentsClient; -type FulfillmentsClient = v2.FulfillmentsClient; -const IntentsClient = v2.IntentsClient; -type IntentsClient = v2.IntentsClient; -const KnowledgeBasesClient = v2.KnowledgeBasesClient; -type KnowledgeBasesClient = v2.KnowledgeBasesClient; -const ParticipantsClient = v2.ParticipantsClient; -type ParticipantsClient = v2.ParticipantsClient; -const SessionEntityTypesClient = v2.SessionEntityTypesClient; -type SessionEntityTypesClient = v2.SessionEntityTypesClient; -const SessionsClient = v2.SessionsClient; -type SessionsClient = v2.SessionsClient; -const VersionsClient = v2.VersionsClient; -type VersionsClient = v2.VersionsClient; -export {v2, AgentsClient, AnswerRecordsClient, ContextsClient, ConversationProfilesClient, ConversationsClient, DocumentsClient, EntityTypesClient, EnvironmentsClient, FulfillmentsClient, IntentsClient, KnowledgeBasesClient, ParticipantsClient, SessionEntityTypesClient, SessionsClient, VersionsClient}; -export default {v2, AgentsClient, AnswerRecordsClient, ContextsClient, ConversationProfilesClient, ConversationsClient, DocumentsClient, EntityTypesClient, EnvironmentsClient, FulfillmentsClient, IntentsClient, KnowledgeBasesClient, ParticipantsClient, SessionEntityTypesClient, SessionsClient, VersionsClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v2/src/v2/agents_client.ts b/owl-bot-staging/v2/src/v2/agents_client.ts deleted file mode 100644 index b186b1e8..00000000 --- a/owl-bot-staging/v2/src/v2/agents_client.ts +++ /dev/null @@ -1,3085 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/agents_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './agents_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2.Agent|Agents}. - * @class - * @memberof v2 - */ -export class AgentsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - agentsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AgentsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof AgentsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - searchAgents: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'agents') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - - this.operationsClient = this._gaxModule.lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }).operationsClient(opts); - const trainAgentResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const trainAgentMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - const exportAgentResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.ExportAgentResponse') as gax.protobuf.Type; - const exportAgentMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - const importAgentResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const importAgentMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - const restoreAgentResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const restoreAgentMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - - this.descriptors.longrunning = { - trainAgent: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - trainAgentResponse.decode.bind(trainAgentResponse), - trainAgentMetadata.decode.bind(trainAgentMetadata)), - exportAgent: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportAgentResponse.decode.bind(exportAgentResponse), - exportAgentMetadata.decode.bind(exportAgentMetadata)), - importAgent: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - importAgentResponse.decode.bind(importAgentResponse), - importAgentMetadata.decode.bind(importAgentMetadata)), - restoreAgent: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - restoreAgentResponse.decode.bind(restoreAgentResponse), - restoreAgentMetadata.decode.bind(restoreAgentMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2.Agents', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.agentsStub) { - return this.agentsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2.Agents. - this.agentsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.Agents') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2.Agents, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const agentsStubMethods = - ['getAgent', 'setAgent', 'deleteAgent', 'searchAgents', 'trainAgent', 'exportAgent', 'importAgent', 'restoreAgent', 'getValidationResult']; - for (const methodName of agentsStubMethods) { - const callPromise = this.agentsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.agentsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getAgent( - request?: protos.google.cloud.dialogflow.v2.IGetAgentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IAgent, - protos.google.cloud.dialogflow.v2.IGetAgentRequest|undefined, {}|undefined - ]>; - getAgent( - request: protos.google.cloud.dialogflow.v2.IGetAgentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IAgent, - protos.google.cloud.dialogflow.v2.IGetAgentRequest|null|undefined, - {}|null|undefined>): void; - getAgent( - request: protos.google.cloud.dialogflow.v2.IGetAgentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IAgent, - protos.google.cloud.dialogflow.v2.IGetAgentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specified agent. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project that the agent to fetch is associated with. - * Format: `projects/`. - * @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. - * The first element of the array is an object representing [Agent]{@link google.cloud.dialogflow.v2.Agent}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getAgent(request); - */ - getAgent( - request?: protos.google.cloud.dialogflow.v2.IGetAgentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IAgent, - protos.google.cloud.dialogflow.v2.IGetAgentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IAgent, - protos.google.cloud.dialogflow.v2.IGetAgentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IAgent, - protos.google.cloud.dialogflow.v2.IGetAgentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.getAgent(request, options, callback); - } - setAgent( - request?: protos.google.cloud.dialogflow.v2.ISetAgentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IAgent, - protos.google.cloud.dialogflow.v2.ISetAgentRequest|undefined, {}|undefined - ]>; - setAgent( - request: protos.google.cloud.dialogflow.v2.ISetAgentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IAgent, - protos.google.cloud.dialogflow.v2.ISetAgentRequest|null|undefined, - {}|null|undefined>): void; - setAgent( - request: protos.google.cloud.dialogflow.v2.ISetAgentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IAgent, - protos.google.cloud.dialogflow.v2.ISetAgentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates/updates the specified agent. - * - * Note: You should always train an agent prior to sending it queries. See the - * [training - * documentation](https://cloud.google.com/dialogflow/es/docs/training). - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2.Agent} request.agent - * Required. The agent to update. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The mask to control which fields get updated. - * @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. - * The first element of the array is an object representing [Agent]{@link google.cloud.dialogflow.v2.Agent}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.setAgent(request); - */ - setAgent( - request?: protos.google.cloud.dialogflow.v2.ISetAgentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IAgent, - protos.google.cloud.dialogflow.v2.ISetAgentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IAgent, - protos.google.cloud.dialogflow.v2.ISetAgentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IAgent, - protos.google.cloud.dialogflow.v2.ISetAgentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'agent.parent': request.agent!.parent || '', - }); - this.initialize(); - return this.innerApiCalls.setAgent(request, options, callback); - } - deleteAgent( - request?: protos.google.cloud.dialogflow.v2.IDeleteAgentRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteAgentRequest|undefined, {}|undefined - ]>; - deleteAgent( - request: protos.google.cloud.dialogflow.v2.IDeleteAgentRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteAgentRequest|null|undefined, - {}|null|undefined>): void; - deleteAgent( - request: protos.google.cloud.dialogflow.v2.IDeleteAgentRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteAgentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deletes the specified agent. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project that the agent to delete is associated with. - * Format: `projects/`. - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteAgent(request); - */ - deleteAgent( - request?: protos.google.cloud.dialogflow.v2.IDeleteAgentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteAgentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteAgentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteAgentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.deleteAgent(request, options, callback); - } - getValidationResult( - request?: protos.google.cloud.dialogflow.v2.IGetValidationResultRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IValidationResult, - protos.google.cloud.dialogflow.v2.IGetValidationResultRequest|undefined, {}|undefined - ]>; - getValidationResult( - request: protos.google.cloud.dialogflow.v2.IGetValidationResultRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IValidationResult, - protos.google.cloud.dialogflow.v2.IGetValidationResultRequest|null|undefined, - {}|null|undefined>): void; - getValidationResult( - request: protos.google.cloud.dialogflow.v2.IGetValidationResultRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IValidationResult, - protos.google.cloud.dialogflow.v2.IGetValidationResultRequest|null|undefined, - {}|null|undefined>): void; -/** - * Gets agent validation result. Agent validation is performed during - * training time and is updated automatically when training is completed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project that the agent is associated with. - * Format: `projects/`. - * @param {string} [request.languageCode] - * Optional. The language for which you want a validation result. If not - * specified, the agent's default language is used. [Many - * languages](https://cloud.google.com/dialogflow/docs/reference/language) - * are supported. Note: languages must be enabled in the agent before they can - * be used. - * @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. - * The first element of the array is an object representing [ValidationResult]{@link google.cloud.dialogflow.v2.ValidationResult}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getValidationResult(request); - */ - getValidationResult( - request?: protos.google.cloud.dialogflow.v2.IGetValidationResultRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IValidationResult, - protos.google.cloud.dialogflow.v2.IGetValidationResultRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IValidationResult, - protos.google.cloud.dialogflow.v2.IGetValidationResultRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IValidationResult, - protos.google.cloud.dialogflow.v2.IGetValidationResultRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.getValidationResult(request, options, callback); - } - - trainAgent( - request?: protos.google.cloud.dialogflow.v2.ITrainAgentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - trainAgent( - request: protos.google.cloud.dialogflow.v2.ITrainAgentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - trainAgent( - request: protos.google.cloud.dialogflow.v2.ITrainAgentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Trains the specified agent. - * - * - * Note: You should always train an agent prior to sending it queries. See the - * [training - * documentation](https://cloud.google.com/dialogflow/es/docs/training). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project that the agent to train is associated with. - * Format: `projects/`. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.trainAgent(request); - * const [response] = await operation.promise(); - */ - trainAgent( - request?: protos.google.cloud.dialogflow.v2.ITrainAgentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.trainAgent(request, options, callback); - } -/** - * Check the status of the long running operation returned by `trainAgent()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkTrainAgentProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkTrainAgentProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.trainAgent, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - exportAgent( - request?: protos.google.cloud.dialogflow.v2.IExportAgentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportAgent( - request: protos.google.cloud.dialogflow.v2.IExportAgentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportAgent( - request: protos.google.cloud.dialogflow.v2.IExportAgentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Exports the specified agent to a ZIP file. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project that the agent to export is associated with. - * Format: `projects/`. - * @param {string} request.agentUri - * Required. The [Google Cloud Storage](https://cloud.google.com/storage/docs/) - * URI to export the agent to. - * The format of this URI must be `gs:///`. - * If left unspecified, the serialized agent is returned inline. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.exportAgent(request); - * const [response] = await operation.promise(); - */ - exportAgent( - request?: protos.google.cloud.dialogflow.v2.IExportAgentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.exportAgent(request, options, callback); - } -/** - * Check the status of the long running operation returned by `exportAgent()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkExportAgentProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkExportAgentProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.exportAgent, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - importAgent( - request?: protos.google.cloud.dialogflow.v2.IImportAgentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - importAgent( - request: protos.google.cloud.dialogflow.v2.IImportAgentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importAgent( - request: protos.google.cloud.dialogflow.v2.IImportAgentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Imports the specified agent from a ZIP file. - * - * Uploads new intents and entity types without deleting the existing ones. - * Intents and entity types with the same name are replaced with the new - * versions from {@link google.cloud.dialogflow.v2.ImportAgentRequest|ImportAgentRequest}. After the import, the imported draft - * agent will be trained automatically (unless disabled in agent settings). - * However, once the import is done, training may not be completed yet. Please - * call {@link google.cloud.dialogflow.v2.Agents.TrainAgent|TrainAgent} and wait for the operation it returns in order to train - * explicitly. - * - * An operation which tracks when importing is complete. It only tracks - * when the draft agent is updated not when it is done training. - * - * Note: You should always train an agent prior to sending it queries. See the - * [training - * documentation](https://cloud.google.com/dialogflow/es/docs/training). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project that the agent to import is associated with. - * Format: `projects/`. - * @param {string} request.agentUri - * The URI to a Google Cloud Storage file containing the agent to import. - * Note: The URI must start with "gs://". - * @param {Buffer} request.agentContent - * Zip compressed raw byte content for agent. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.importAgent(request); - * const [response] = await operation.promise(); - */ - importAgent( - request?: protos.google.cloud.dialogflow.v2.IImportAgentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.importAgent(request, options, callback); - } -/** - * Check the status of the long running operation returned by `importAgent()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkImportAgentProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkImportAgentProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.importAgent, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - restoreAgent( - request?: protos.google.cloud.dialogflow.v2.IRestoreAgentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - restoreAgent( - request: protos.google.cloud.dialogflow.v2.IRestoreAgentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreAgent( - request: protos.google.cloud.dialogflow.v2.IRestoreAgentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Restores the specified agent from a ZIP file. - * - * Replaces the current agent version with a new one. All the intents and - * entity types in the older version are deleted. After the restore, the - * restored draft agent will be trained automatically (unless disabled in - * agent settings). However, once the restore is done, training may not be - * completed yet. Please call {@link google.cloud.dialogflow.v2.Agents.TrainAgent|TrainAgent} and wait for the operation it - * returns in order to train explicitly. - * - * An operation which tracks when restoring is complete. It only tracks - * when the draft agent is updated not when it is done training. - * - * Note: You should always train an agent prior to sending it queries. See the - * [training - * documentation](https://cloud.google.com/dialogflow/es/docs/training). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project that the agent to restore is associated with. - * Format: `projects/`. - * @param {string} request.agentUri - * The URI to a Google Cloud Storage file containing the agent to restore. - * Note: The URI must start with "gs://". - * @param {Buffer} request.agentContent - * Zip compressed raw byte content for agent. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.restoreAgent(request); - * const [response] = await operation.promise(); - */ - restoreAgent( - request?: protos.google.cloud.dialogflow.v2.IRestoreAgentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.restoreAgent(request, options, callback); - } -/** - * Check the status of the long running operation returned by `restoreAgent()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkRestoreAgentProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkRestoreAgentProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.restoreAgent, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - searchAgents( - request?: protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IAgent[], - protos.google.cloud.dialogflow.v2.ISearchAgentsRequest|null, - protos.google.cloud.dialogflow.v2.ISearchAgentsResponse - ]>; - searchAgents( - request: protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, - protos.google.cloud.dialogflow.v2.ISearchAgentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IAgent>): void; - searchAgents( - request: protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, - protos.google.cloud.dialogflow.v2.ISearchAgentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IAgent>): void; -/** - * Returns the list of agents. - * - * Since there is at most one conversational agent per project, this method is - * useful primarily for listing all agents across projects the caller has - * access to. One can achieve that with a wildcard project collection id "-". - * Refer to [List - * Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list agents from. - * Format: `projects/`. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [Agent]{@link google.cloud.dialogflow.v2.Agent}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `searchAgentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - searchAgents( - request?: protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, - protos.google.cloud.dialogflow.v2.ISearchAgentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IAgent>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, - protos.google.cloud.dialogflow.v2.ISearchAgentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IAgent>): - Promise<[ - protos.google.cloud.dialogflow.v2.IAgent[], - protos.google.cloud.dialogflow.v2.ISearchAgentsRequest|null, - protos.google.cloud.dialogflow.v2.ISearchAgentsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.searchAgents(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list agents from. - * Format: `projects/`. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Agent]{@link google.cloud.dialogflow.v2.Agent} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `searchAgentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - searchAgentsStream( - request?: protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.searchAgents.createStream( - this.innerApiCalls.searchAgents as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `searchAgents`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list agents from. - * Format: `projects/`. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Agent]{@link google.cloud.dialogflow.v2.Agent}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.searchAgentsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - searchAgentsAsync( - request?: protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.searchAgents.asyncIterate( - this.innerApiCalls['searchAgents'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.agentsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/agents_client_config.json b/owl-bot-staging/v2/src/v2/agents_client_config.json deleted file mode 100644 index 93d6e00d..00000000 --- a/owl-bot-staging/v2/src/v2/agents_client_config.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2.Agents": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetAgent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "SetAgent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteAgent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "SearchAgents": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "TrainAgent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ExportAgent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ImportAgent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "RestoreAgent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetValidationResult": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/agents_proto_list.json b/owl-bot-staging/v2/src/v2/agents_proto_list.json deleted file mode 100644 index d2ecb25e..00000000 --- a/owl-bot-staging/v2/src/v2/agents_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2/agent.proto", - "../../protos/google/cloud/dialogflow/v2/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2/context.proto", - "../../protos/google/cloud/dialogflow/v2/conversation.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2/document.proto", - "../../protos/google/cloud/dialogflow/v2/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/environment.proto", - "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2/gcs.proto", - "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2/intent.proto", - "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2/participant.proto", - "../../protos/google/cloud/dialogflow/v2/session.proto", - "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2/version.proto", - "../../protos/google/cloud/dialogflow/v2/webhook.proto" -] diff --git a/owl-bot-staging/v2/src/v2/answer_records_client.ts b/owl-bot-staging/v2/src/v2/answer_records_client.ts deleted file mode 100644 index 091de818..00000000 --- a/owl-bot-staging/v2/src/v2/answer_records_client.ts +++ /dev/null @@ -1,2408 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/answer_records_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './answer_records_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2.AnswerRecord|AnswerRecords}. - * @class - * @memberof v2 - */ -export class AnswerRecordsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - answerRecordsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AnswerRecordsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof AnswerRecordsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listAnswerRecords: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'answerRecords') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2.AnswerRecords', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.answerRecordsStub) { - return this.answerRecordsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2.AnswerRecords. - this.answerRecordsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.AnswerRecords') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2.AnswerRecords, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const answerRecordsStubMethods = - ['listAnswerRecords', 'updateAnswerRecord']; - for (const methodName of answerRecordsStubMethods) { - const callPromise = this.answerRecordsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.answerRecordsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - updateAnswerRecord( - request?: protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IAnswerRecord, - protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest|undefined, {}|undefined - ]>; - updateAnswerRecord( - request: protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IAnswerRecord, - protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest|null|undefined, - {}|null|undefined>): void; - updateAnswerRecord( - request: protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IAnswerRecord, - protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified answer record. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2.AnswerRecord} request.answerRecord - * Required. Answer record to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The mask to control which fields get updated. - * @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. - * The first element of the array is an object representing [AnswerRecord]{@link google.cloud.dialogflow.v2.AnswerRecord}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateAnswerRecord(request); - */ - updateAnswerRecord( - request?: protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IAnswerRecord, - protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IAnswerRecord, - protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IAnswerRecord, - protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'answer_record.name': request.answerRecord!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateAnswerRecord(request, options, callback); - } - - listAnswerRecords( - request?: protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IAnswerRecord[], - protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest|null, - protos.google.cloud.dialogflow.v2.IListAnswerRecordsResponse - ]>; - listAnswerRecords( - request: protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, - protos.google.cloud.dialogflow.v2.IListAnswerRecordsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IAnswerRecord>): void; - listAnswerRecords( - request: protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, - protos.google.cloud.dialogflow.v2.IListAnswerRecordsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IAnswerRecord>): void; -/** - * Returns the list of all answer records in the specified project in reverse - * chronological order. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list all answer records for in reverse - * chronological order. Format: `projects//locations/`. - * @param {string} request.filter - * Required. Filters to restrict results to specific answer records. - * Filter on answer record type. Currently predicates on `type` is supported, - * valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`. - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @param {number} [request.pageSize] - * Optional. The maximum number of records to return in a single page. - * The server may return fewer records than this. If unspecified, we use 10. - * The maximum is 100. - * @param {string} [request.pageToken] - * Optional. The - * {@link google.cloud.dialogflow.v2.ListAnswerRecordsResponse.next_page_token|ListAnswerRecordsResponse.next_page_token} - * value returned from a previous list request used to continue listing on - * the next page. - * @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. - * The first element of the array is Array of [AnswerRecord]{@link google.cloud.dialogflow.v2.AnswerRecord}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listAnswerRecordsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAnswerRecords( - request?: protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, - protos.google.cloud.dialogflow.v2.IListAnswerRecordsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IAnswerRecord>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, - protos.google.cloud.dialogflow.v2.IListAnswerRecordsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IAnswerRecord>): - Promise<[ - protos.google.cloud.dialogflow.v2.IAnswerRecord[], - protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest|null, - protos.google.cloud.dialogflow.v2.IListAnswerRecordsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listAnswerRecords(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list all answer records for in reverse - * chronological order. Format: `projects//locations/`. - * @param {string} request.filter - * Required. Filters to restrict results to specific answer records. - * Filter on answer record type. Currently predicates on `type` is supported, - * valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`. - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @param {number} [request.pageSize] - * Optional. The maximum number of records to return in a single page. - * The server may return fewer records than this. If unspecified, we use 10. - * The maximum is 100. - * @param {string} [request.pageToken] - * Optional. The - * {@link google.cloud.dialogflow.v2.ListAnswerRecordsResponse.next_page_token|ListAnswerRecordsResponse.next_page_token} - * value returned from a previous list request used to continue listing on - * the next page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [AnswerRecord]{@link google.cloud.dialogflow.v2.AnswerRecord} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listAnswerRecordsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAnswerRecordsStream( - request?: protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listAnswerRecords.createStream( - this.innerApiCalls.listAnswerRecords as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAnswerRecords`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list all answer records for in reverse - * chronological order. Format: `projects//locations/`. - * @param {string} request.filter - * Required. Filters to restrict results to specific answer records. - * Filter on answer record type. Currently predicates on `type` is supported, - * valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`. - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @param {number} [request.pageSize] - * Optional. The maximum number of records to return in a single page. - * The server may return fewer records than this. If unspecified, we use 10. - * The maximum is 100. - * @param {string} [request.pageToken] - * Optional. The - * {@link google.cloud.dialogflow.v2.ListAnswerRecordsResponse.next_page_token|ListAnswerRecordsResponse.next_page_token} - * value returned from a previous list request used to continue listing on - * the next page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [AnswerRecord]{@link google.cloud.dialogflow.v2.AnswerRecord}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listAnswerRecordsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listAnswerRecordsAsync( - request?: protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listAnswerRecords.asyncIterate( - this.innerApiCalls['listAnswerRecords'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.answerRecordsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/answer_records_client_config.json b/owl-bot-staging/v2/src/v2/answer_records_client_config.json deleted file mode 100644 index cc29e1ea..00000000 --- a/owl-bot-staging/v2/src/v2/answer_records_client_config.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2.AnswerRecords": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListAnswerRecords": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateAnswerRecord": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/answer_records_proto_list.json b/owl-bot-staging/v2/src/v2/answer_records_proto_list.json deleted file mode 100644 index d2ecb25e..00000000 --- a/owl-bot-staging/v2/src/v2/answer_records_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2/agent.proto", - "../../protos/google/cloud/dialogflow/v2/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2/context.proto", - "../../protos/google/cloud/dialogflow/v2/conversation.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2/document.proto", - "../../protos/google/cloud/dialogflow/v2/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/environment.proto", - "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2/gcs.proto", - "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2/intent.proto", - "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2/participant.proto", - "../../protos/google/cloud/dialogflow/v2/session.proto", - "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2/version.proto", - "../../protos/google/cloud/dialogflow/v2/webhook.proto" -] diff --git a/owl-bot-staging/v2/src/v2/contexts_client.ts b/owl-bot-staging/v2/src/v2/contexts_client.ts deleted file mode 100644 index df97d6f0..00000000 --- a/owl-bot-staging/v2/src/v2/contexts_client.ts +++ /dev/null @@ -1,2730 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/contexts_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './contexts_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2.Context|Contexts}. - * @class - * @memberof v2 - */ -export class ContextsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - contextsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ContextsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ContextsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listContexts: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'contexts') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2.Contexts', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.contextsStub) { - return this.contextsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2.Contexts. - this.contextsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.Contexts') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2.Contexts, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const contextsStubMethods = - ['listContexts', 'getContext', 'createContext', 'updateContext', 'deleteContext', 'deleteAllContexts']; - for (const methodName of contextsStubMethods) { - const callPromise = this.contextsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.contextsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getContext( - request?: protos.google.cloud.dialogflow.v2.IGetContextRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IContext, - protos.google.cloud.dialogflow.v2.IGetContextRequest|undefined, {}|undefined - ]>; - getContext( - request: protos.google.cloud.dialogflow.v2.IGetContextRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IContext, - protos.google.cloud.dialogflow.v2.IGetContextRequest|null|undefined, - {}|null|undefined>): void; - getContext( - request: protos.google.cloud.dialogflow.v2.IGetContextRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IContext, - protos.google.cloud.dialogflow.v2.IGetContextRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specified context. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the context. Format: - * `projects//agent/sessions//contexts/` - * or `projects//agent/environments//users//sessions//contexts/`. - * If `Environment ID` is not specified, we assume default 'draft' - * environment. If `User ID` is not specified, we assume default '-' user. - * @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. - * The first element of the array is an object representing [Context]{@link google.cloud.dialogflow.v2.Context}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getContext(request); - */ - getContext( - request?: protos.google.cloud.dialogflow.v2.IGetContextRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IContext, - protos.google.cloud.dialogflow.v2.IGetContextRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IContext, - protos.google.cloud.dialogflow.v2.IGetContextRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IContext, - protos.google.cloud.dialogflow.v2.IGetContextRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getContext(request, options, callback); - } - createContext( - request?: protos.google.cloud.dialogflow.v2.ICreateContextRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IContext, - protos.google.cloud.dialogflow.v2.ICreateContextRequest|undefined, {}|undefined - ]>; - createContext( - request: protos.google.cloud.dialogflow.v2.ICreateContextRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IContext, - protos.google.cloud.dialogflow.v2.ICreateContextRequest|null|undefined, - {}|null|undefined>): void; - createContext( - request: protos.google.cloud.dialogflow.v2.ICreateContextRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IContext, - protos.google.cloud.dialogflow.v2.ICreateContextRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates a context. - * - * If the specified context already exists, overrides the context. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The session to create a context for. - * Format: `projects//agent/sessions/` or - * `projects//agent/environments//users//sessions/`. - * If `Environment ID` is not specified, we assume default 'draft' - * environment. If `User ID` is not specified, we assume default '-' user. - * @param {google.cloud.dialogflow.v2.Context} request.context - * Required. The context to create. - * @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. - * The first element of the array is an object representing [Context]{@link google.cloud.dialogflow.v2.Context}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createContext(request); - */ - createContext( - request?: protos.google.cloud.dialogflow.v2.ICreateContextRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IContext, - protos.google.cloud.dialogflow.v2.ICreateContextRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IContext, - protos.google.cloud.dialogflow.v2.ICreateContextRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IContext, - protos.google.cloud.dialogflow.v2.ICreateContextRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createContext(request, options, callback); - } - updateContext( - request?: protos.google.cloud.dialogflow.v2.IUpdateContextRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IContext, - protos.google.cloud.dialogflow.v2.IUpdateContextRequest|undefined, {}|undefined - ]>; - updateContext( - request: protos.google.cloud.dialogflow.v2.IUpdateContextRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IContext, - protos.google.cloud.dialogflow.v2.IUpdateContextRequest|null|undefined, - {}|null|undefined>): void; - updateContext( - request: protos.google.cloud.dialogflow.v2.IUpdateContextRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IContext, - protos.google.cloud.dialogflow.v2.IUpdateContextRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified context. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2.Context} request.context - * Required. The context to update. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The mask to control which fields get updated. - * @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. - * The first element of the array is an object representing [Context]{@link google.cloud.dialogflow.v2.Context}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateContext(request); - */ - updateContext( - request?: protos.google.cloud.dialogflow.v2.IUpdateContextRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IContext, - protos.google.cloud.dialogflow.v2.IUpdateContextRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IContext, - protos.google.cloud.dialogflow.v2.IUpdateContextRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IContext, - protos.google.cloud.dialogflow.v2.IUpdateContextRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'context.name': request.context!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateContext(request, options, callback); - } - deleteContext( - request?: protos.google.cloud.dialogflow.v2.IDeleteContextRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteContextRequest|undefined, {}|undefined - ]>; - deleteContext( - request: protos.google.cloud.dialogflow.v2.IDeleteContextRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteContextRequest|null|undefined, - {}|null|undefined>): void; - deleteContext( - request: protos.google.cloud.dialogflow.v2.IDeleteContextRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteContextRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deletes the specified context. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the context to delete. Format: - * `projects//agent/sessions//contexts/` - * or `projects//agent/environments//users//sessions//contexts/`. - * If `Environment ID` is not specified, we assume default 'draft' - * environment. If `User ID` is not specified, we assume default '-' user. - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteContext(request); - */ - deleteContext( - request?: protos.google.cloud.dialogflow.v2.IDeleteContextRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteContextRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteContextRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteContextRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteContext(request, options, callback); - } - deleteAllContexts( - request?: protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest|undefined, {}|undefined - ]>; - deleteAllContexts( - request: protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest|null|undefined, - {}|null|undefined>): void; - deleteAllContexts( - request: protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deletes all active contexts in the specified session. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the session to delete all contexts from. Format: - * `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. - * If `Environment ID` is not specified we assume default 'draft' environment. - * If `User ID` is not specified, we assume default '-' user. - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteAllContexts(request); - */ - deleteAllContexts( - request?: protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.deleteAllContexts(request, options, callback); - } - - listContexts( - request?: protos.google.cloud.dialogflow.v2.IListContextsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IContext[], - protos.google.cloud.dialogflow.v2.IListContextsRequest|null, - protos.google.cloud.dialogflow.v2.IListContextsResponse - ]>; - listContexts( - request: protos.google.cloud.dialogflow.v2.IListContextsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListContextsRequest, - protos.google.cloud.dialogflow.v2.IListContextsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IContext>): void; - listContexts( - request: protos.google.cloud.dialogflow.v2.IListContextsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListContextsRequest, - protos.google.cloud.dialogflow.v2.IListContextsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IContext>): void; -/** - * Returns the list of all contexts in the specified session. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The session to list all contexts from. - * Format: `projects//agent/sessions/` or - * `projects//agent/environments//users//sessions/`. - * If `Environment ID` is not specified, we assume default 'draft' - * environment. If `User ID` is not specified, we assume default '-' user. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [Context]{@link google.cloud.dialogflow.v2.Context}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listContextsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listContexts( - request?: protos.google.cloud.dialogflow.v2.IListContextsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2.IListContextsRequest, - protos.google.cloud.dialogflow.v2.IListContextsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IContext>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListContextsRequest, - protos.google.cloud.dialogflow.v2.IListContextsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IContext>): - Promise<[ - protos.google.cloud.dialogflow.v2.IContext[], - protos.google.cloud.dialogflow.v2.IListContextsRequest|null, - protos.google.cloud.dialogflow.v2.IListContextsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listContexts(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The session to list all contexts from. - * Format: `projects//agent/sessions/` or - * `projects//agent/environments//users//sessions/`. - * If `Environment ID` is not specified, we assume default 'draft' - * environment. If `User ID` is not specified, we assume default '-' user. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Context]{@link google.cloud.dialogflow.v2.Context} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listContextsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listContextsStream( - request?: protos.google.cloud.dialogflow.v2.IListContextsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listContexts.createStream( - this.innerApiCalls.listContexts as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listContexts`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The session to list all contexts from. - * Format: `projects//agent/sessions/` or - * `projects//agent/environments//users//sessions/`. - * If `Environment ID` is not specified, we assume default 'draft' - * environment. If `User ID` is not specified, we assume default '-' user. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Context]{@link google.cloud.dialogflow.v2.Context}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listContextsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listContextsAsync( - request?: protos.google.cloud.dialogflow.v2.IListContextsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listContexts.asyncIterate( - this.innerApiCalls['listContexts'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSession resource name string. - * - * @param {string} project - * @param {string} session - * @returns {string} Resource name string. - */ - projectAgentSessionPath(project:string,session:string) { - return this.pathTemplates.projectAgentSessionPathTemplate.render({ - project: project, - session: session, - }); - } - - /** - * Parse the project from ProjectAgentSession resource. - * - * @param {string} projectAgentSessionName - * A fully-qualified path representing project_agent_session resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionName(projectAgentSessionName: string) { - return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).project; - } - - /** - * Parse the session from ProjectAgentSession resource. - * - * @param {string} projectAgentSessionName - * A fully-qualified path representing project_agent_session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionName(projectAgentSessionName: string) { - return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).session; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.contextsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/contexts_client_config.json b/owl-bot-staging/v2/src/v2/contexts_client_config.json deleted file mode 100644 index c44e6aaa..00000000 --- a/owl-bot-staging/v2/src/v2/contexts_client_config.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2.Contexts": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListContexts": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetContext": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateContext": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateContext": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteContext": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteAllContexts": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/contexts_proto_list.json b/owl-bot-staging/v2/src/v2/contexts_proto_list.json deleted file mode 100644 index d2ecb25e..00000000 --- a/owl-bot-staging/v2/src/v2/contexts_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2/agent.proto", - "../../protos/google/cloud/dialogflow/v2/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2/context.proto", - "../../protos/google/cloud/dialogflow/v2/conversation.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2/document.proto", - "../../protos/google/cloud/dialogflow/v2/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/environment.proto", - "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2/gcs.proto", - "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2/intent.proto", - "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2/participant.proto", - "../../protos/google/cloud/dialogflow/v2/session.proto", - "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2/version.proto", - "../../protos/google/cloud/dialogflow/v2/webhook.proto" -] diff --git a/owl-bot-staging/v2/src/v2/conversation_profiles_client.ts b/owl-bot-staging/v2/src/v2/conversation_profiles_client.ts deleted file mode 100644 index 2d9fa724..00000000 --- a/owl-bot-staging/v2/src/v2/conversation_profiles_client.ts +++ /dev/null @@ -1,2599 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/conversation_profiles_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './conversation_profiles_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2.ConversationProfile|ConversationProfiles}. - * @class - * @memberof v2 - */ -export class ConversationProfilesClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - conversationProfilesStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ConversationProfilesClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ConversationProfilesClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listConversationProfiles: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'conversationProfiles') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2.ConversationProfiles', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.conversationProfilesStub) { - return this.conversationProfilesStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2.ConversationProfiles. - this.conversationProfilesStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.ConversationProfiles') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2.ConversationProfiles, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const conversationProfilesStubMethods = - ['listConversationProfiles', 'getConversationProfile', 'createConversationProfile', 'updateConversationProfile', 'deleteConversationProfile']; - for (const methodName of conversationProfilesStubMethods) { - const callPromise = this.conversationProfilesStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.conversationProfilesStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getConversationProfile( - request?: protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversationProfile, - protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest|undefined, {}|undefined - ]>; - getConversationProfile( - request: protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IConversationProfile, - protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest|null|undefined, - {}|null|undefined>): void; - getConversationProfile( - request: protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IConversationProfile, - protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specified conversation profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the conversation profile. - * Format: `projects//locations//conversationProfiles/`. - * @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. - * The first element of the array is an object representing [ConversationProfile]{@link google.cloud.dialogflow.v2.ConversationProfile}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getConversationProfile(request); - */ - getConversationProfile( - request?: protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IConversationProfile, - protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IConversationProfile, - protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversationProfile, - protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getConversationProfile(request, options, callback); - } - createConversationProfile( - request?: protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversationProfile, - protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest|undefined, {}|undefined - ]>; - createConversationProfile( - request: protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IConversationProfile, - protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest|null|undefined, - {}|null|undefined>): void; - createConversationProfile( - request: protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IConversationProfile, - protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates a conversation profile in the specified project. - * - * {@link |ConversationProfile.CreateTime} and {@link |ConversationProfile.UpdateTime} - * aren't populated in the response. You can retrieve them via - * {@link google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile|GetConversationProfile} API. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to create a conversation profile for. - * Format: `projects//locations/`. - * @param {google.cloud.dialogflow.v2.ConversationProfile} request.conversationProfile - * Required. The conversation profile to create. - * @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. - * The first element of the array is an object representing [ConversationProfile]{@link google.cloud.dialogflow.v2.ConversationProfile}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createConversationProfile(request); - */ - createConversationProfile( - request?: protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IConversationProfile, - protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IConversationProfile, - protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversationProfile, - protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createConversationProfile(request, options, callback); - } - updateConversationProfile( - request?: protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversationProfile, - protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest|undefined, {}|undefined - ]>; - updateConversationProfile( - request: protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IConversationProfile, - protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest|null|undefined, - {}|null|undefined>): void; - updateConversationProfile( - request: protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IConversationProfile, - protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified conversation profile. - * - * {@link |ConversationProfile.CreateTime} and {@link |ConversationProfile.UpdateTime} - * aren't populated in the response. You can retrieve them via - * {@link google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile|GetConversationProfile} API. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2.ConversationProfile} request.conversationProfile - * Required. The conversation profile to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The mask to control which fields to update. - * @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. - * The first element of the array is an object representing [ConversationProfile]{@link google.cloud.dialogflow.v2.ConversationProfile}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateConversationProfile(request); - */ - updateConversationProfile( - request?: protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IConversationProfile, - protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IConversationProfile, - protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversationProfile, - protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'conversation_profile.name': request.conversationProfile!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateConversationProfile(request, options, callback); - } - deleteConversationProfile( - request?: protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest|undefined, {}|undefined - ]>; - deleteConversationProfile( - request: protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest|null|undefined, - {}|null|undefined>): void; - deleteConversationProfile( - request: protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deletes the specified conversation profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the conversation profile to delete. - * Format: `projects//locations//conversationProfiles/`. - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteConversationProfile(request); - */ - deleteConversationProfile( - request?: protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteConversationProfile(request, options, callback); - } - - listConversationProfiles( - request?: protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversationProfile[], - protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest|null, - protos.google.cloud.dialogflow.v2.IListConversationProfilesResponse - ]>; - listConversationProfiles( - request: protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, - protos.google.cloud.dialogflow.v2.IListConversationProfilesResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IConversationProfile>): void; - listConversationProfiles( - request: protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, - protos.google.cloud.dialogflow.v2.IListConversationProfilesResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IConversationProfile>): void; -/** - * Returns the list of all conversation profiles in the specified project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list all conversation profiles from. - * Format: `projects//locations/`. - * @param {number} request.pageSize - * The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [ConversationProfile]{@link google.cloud.dialogflow.v2.ConversationProfile}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listConversationProfilesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listConversationProfiles( - request?: protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, - protos.google.cloud.dialogflow.v2.IListConversationProfilesResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IConversationProfile>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, - protos.google.cloud.dialogflow.v2.IListConversationProfilesResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IConversationProfile>): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversationProfile[], - protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest|null, - protos.google.cloud.dialogflow.v2.IListConversationProfilesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listConversationProfiles(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list all conversation profiles from. - * Format: `projects//locations/`. - * @param {number} request.pageSize - * The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [ConversationProfile]{@link google.cloud.dialogflow.v2.ConversationProfile} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listConversationProfilesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listConversationProfilesStream( - request?: protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listConversationProfiles.createStream( - this.innerApiCalls.listConversationProfiles as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listConversationProfiles`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list all conversation profiles from. - * Format: `projects//locations/`. - * @param {number} request.pageSize - * The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [ConversationProfile]{@link google.cloud.dialogflow.v2.ConversationProfile}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listConversationProfilesAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listConversationProfilesAsync( - request?: protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listConversationProfiles.asyncIterate( - this.innerApiCalls['listConversationProfiles'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.conversationProfilesStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/conversation_profiles_client_config.json b/owl-bot-staging/v2/src/v2/conversation_profiles_client_config.json deleted file mode 100644 index 10c64bdc..00000000 --- a/owl-bot-staging/v2/src/v2/conversation_profiles_client_config.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2.ConversationProfiles": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListConversationProfiles": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetConversationProfile": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateConversationProfile": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateConversationProfile": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteConversationProfile": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/conversation_profiles_proto_list.json b/owl-bot-staging/v2/src/v2/conversation_profiles_proto_list.json deleted file mode 100644 index d2ecb25e..00000000 --- a/owl-bot-staging/v2/src/v2/conversation_profiles_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2/agent.proto", - "../../protos/google/cloud/dialogflow/v2/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2/context.proto", - "../../protos/google/cloud/dialogflow/v2/conversation.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2/document.proto", - "../../protos/google/cloud/dialogflow/v2/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/environment.proto", - "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2/gcs.proto", - "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2/intent.proto", - "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2/participant.proto", - "../../protos/google/cloud/dialogflow/v2/session.proto", - "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2/version.proto", - "../../protos/google/cloud/dialogflow/v2/webhook.proto" -] diff --git a/owl-bot-staging/v2/src/v2/conversations_client.ts b/owl-bot-staging/v2/src/v2/conversations_client.ts deleted file mode 100644 index 91aee8e0..00000000 --- a/owl-bot-staging/v2/src/v2/conversations_client.ts +++ /dev/null @@ -1,2818 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/conversations_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './conversations_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2.Conversation|Conversations}. - * @class - * @memberof v2 - */ -export class ConversationsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - conversationsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ConversationsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ConversationsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listConversations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'conversations'), - listMessages: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'messages') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2.Conversations', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.conversationsStub) { - return this.conversationsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2.Conversations. - this.conversationsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.Conversations') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2.Conversations, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const conversationsStubMethods = - ['createConversation', 'listConversations', 'getConversation', 'completeConversation', 'listMessages']; - for (const methodName of conversationsStubMethods) { - const callPromise = this.conversationsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.conversationsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - createConversation( - request?: protos.google.cloud.dialogflow.v2.ICreateConversationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversation, - protos.google.cloud.dialogflow.v2.ICreateConversationRequest|undefined, {}|undefined - ]>; - createConversation( - request: protos.google.cloud.dialogflow.v2.ICreateConversationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IConversation, - protos.google.cloud.dialogflow.v2.ICreateConversationRequest|null|undefined, - {}|null|undefined>): void; - createConversation( - request: protos.google.cloud.dialogflow.v2.ICreateConversationRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IConversation, - protos.google.cloud.dialogflow.v2.ICreateConversationRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates a new conversation. Conversations are auto-completed after 24 - * hours. - * - * Conversation Lifecycle: - * There are two stages during a conversation: Automated Agent Stage and - * Assist Stage. - * - * For Automated Agent Stage, there will be a dialogflow agent responding to - * user queries. - * - * For Assist Stage, there's no dialogflow agent responding to user queries. - * But we will provide suggestions which are generated from conversation. - * - * If {@link google.cloud.dialogflow.v2.Conversation.conversation_profile|Conversation.conversation_profile} is configured for a dialogflow - * agent, conversation will start from `Automated Agent Stage`, otherwise, it - * will start from `Assist Stage`. And during `Automated Agent Stage`, once an - * {@link google.cloud.dialogflow.v2.Intent|Intent} with {@link google.cloud.dialogflow.v2.Intent.live_agent_handoff|Intent.live_agent_handoff} is triggered, conversation - * will transfer to Assist Stage. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource identifier of the project creating the conversation. - * Format: `projects//locations/`. - * @param {google.cloud.dialogflow.v2.Conversation} request.conversation - * Required. The conversation to create. - * @param {string} [request.conversationId] - * Optional. Identifier of the conversation. Generally it's auto generated by Google. - * Only set it if you cannot wait for the response to return a - * auto-generated one to you. - * - * The conversation ID must be compliant with the regression fomula - * "{@link a-zA-Z0-9_-|a-zA-Z}*" with the characters length in range of [3,64]. - * If the field is provided, the caller is resposible for - * 1. the uniqueness of the ID, otherwise the request will be rejected. - * 2. the consistency for whether to use custom ID or not under a project to - * better ensure uniqueness. - * @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. - * The first element of the array is an object representing [Conversation]{@link google.cloud.dialogflow.v2.Conversation}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createConversation(request); - */ - createConversation( - request?: protos.google.cloud.dialogflow.v2.ICreateConversationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IConversation, - protos.google.cloud.dialogflow.v2.ICreateConversationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IConversation, - protos.google.cloud.dialogflow.v2.ICreateConversationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversation, - protos.google.cloud.dialogflow.v2.ICreateConversationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createConversation(request, options, callback); - } - getConversation( - request?: protos.google.cloud.dialogflow.v2.IGetConversationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversation, - protos.google.cloud.dialogflow.v2.IGetConversationRequest|undefined, {}|undefined - ]>; - getConversation( - request: protos.google.cloud.dialogflow.v2.IGetConversationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IConversation, - protos.google.cloud.dialogflow.v2.IGetConversationRequest|null|undefined, - {}|null|undefined>): void; - getConversation( - request: protos.google.cloud.dialogflow.v2.IGetConversationRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IConversation, - protos.google.cloud.dialogflow.v2.IGetConversationRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specific conversation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the conversation. Format: - * `projects//locations//conversations/`. - * @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. - * The first element of the array is an object representing [Conversation]{@link google.cloud.dialogflow.v2.Conversation}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getConversation(request); - */ - getConversation( - request?: protos.google.cloud.dialogflow.v2.IGetConversationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IConversation, - protos.google.cloud.dialogflow.v2.IGetConversationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IConversation, - protos.google.cloud.dialogflow.v2.IGetConversationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversation, - protos.google.cloud.dialogflow.v2.IGetConversationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getConversation(request, options, callback); - } - completeConversation( - request?: protos.google.cloud.dialogflow.v2.ICompleteConversationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversation, - protos.google.cloud.dialogflow.v2.ICompleteConversationRequest|undefined, {}|undefined - ]>; - completeConversation( - request: protos.google.cloud.dialogflow.v2.ICompleteConversationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IConversation, - protos.google.cloud.dialogflow.v2.ICompleteConversationRequest|null|undefined, - {}|null|undefined>): void; - completeConversation( - request: protos.google.cloud.dialogflow.v2.ICompleteConversationRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IConversation, - protos.google.cloud.dialogflow.v2.ICompleteConversationRequest|null|undefined, - {}|null|undefined>): void; -/** - * Completes the specified conversation. Finished conversations are purged - * from the database after 30 days. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource identifier of the conversation to close. - * Format: `projects//locations//conversations/`. - * @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. - * The first element of the array is an object representing [Conversation]{@link google.cloud.dialogflow.v2.Conversation}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.completeConversation(request); - */ - completeConversation( - request?: protos.google.cloud.dialogflow.v2.ICompleteConversationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IConversation, - protos.google.cloud.dialogflow.v2.ICompleteConversationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IConversation, - protos.google.cloud.dialogflow.v2.ICompleteConversationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversation, - protos.google.cloud.dialogflow.v2.ICompleteConversationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.completeConversation(request, options, callback); - } - - listConversations( - request?: protos.google.cloud.dialogflow.v2.IListConversationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversation[], - protos.google.cloud.dialogflow.v2.IListConversationsRequest|null, - protos.google.cloud.dialogflow.v2.IListConversationsResponse - ]>; - listConversations( - request: protos.google.cloud.dialogflow.v2.IListConversationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListConversationsRequest, - protos.google.cloud.dialogflow.v2.IListConversationsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IConversation>): void; - listConversations( - request: protos.google.cloud.dialogflow.v2.IListConversationsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListConversationsRequest, - protos.google.cloud.dialogflow.v2.IListConversationsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IConversation>): void; -/** - * Returns the list of all conversations in the specified project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project from which to list all conversation. - * Format: `projects//locations/`. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {string} request.filter - * A filter expression that filters conversations listed in the response. In - * general, the expression must specify the field name, a comparison operator, - * and the value to use for filtering: - *
    - *
  • The value must be a string, a number, or a boolean.
  • - *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • - *
  • To filter on multiple expressions, separate the - * expressions with `AND` or `OR` (omitting both implies `AND`).
  • - *
  • For clarity, expressions can be enclosed in parentheses.
  • - *
- * Only `lifecycle_state` can be filtered on in this way. For example, - * the following expression only returns `COMPLETED` conversations: - * - * `lifecycle_state = "COMPLETED"` - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @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. - * The first element of the array is Array of [Conversation]{@link google.cloud.dialogflow.v2.Conversation}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listConversationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listConversations( - request?: protos.google.cloud.dialogflow.v2.IListConversationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2.IListConversationsRequest, - protos.google.cloud.dialogflow.v2.IListConversationsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IConversation>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListConversationsRequest, - protos.google.cloud.dialogflow.v2.IListConversationsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IConversation>): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversation[], - protos.google.cloud.dialogflow.v2.IListConversationsRequest|null, - protos.google.cloud.dialogflow.v2.IListConversationsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listConversations(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project from which to list all conversation. - * Format: `projects//locations/`. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {string} request.filter - * A filter expression that filters conversations listed in the response. In - * general, the expression must specify the field name, a comparison operator, - * and the value to use for filtering: - *
    - *
  • The value must be a string, a number, or a boolean.
  • - *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • - *
  • To filter on multiple expressions, separate the - * expressions with `AND` or `OR` (omitting both implies `AND`).
  • - *
  • For clarity, expressions can be enclosed in parentheses.
  • - *
- * Only `lifecycle_state` can be filtered on in this way. For example, - * the following expression only returns `COMPLETED` conversations: - * - * `lifecycle_state = "COMPLETED"` - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Conversation]{@link google.cloud.dialogflow.v2.Conversation} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listConversationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listConversationsStream( - request?: protos.google.cloud.dialogflow.v2.IListConversationsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listConversations.createStream( - this.innerApiCalls.listConversations as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listConversations`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project from which to list all conversation. - * Format: `projects//locations/`. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {string} request.filter - * A filter expression that filters conversations listed in the response. In - * general, the expression must specify the field name, a comparison operator, - * and the value to use for filtering: - *
    - *
  • The value must be a string, a number, or a boolean.
  • - *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • - *
  • To filter on multiple expressions, separate the - * expressions with `AND` or `OR` (omitting both implies `AND`).
  • - *
  • For clarity, expressions can be enclosed in parentheses.
  • - *
- * Only `lifecycle_state` can be filtered on in this way. For example, - * the following expression only returns `COMPLETED` conversations: - * - * `lifecycle_state = "COMPLETED"` - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Conversation]{@link google.cloud.dialogflow.v2.Conversation}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listConversationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listConversationsAsync( - request?: protos.google.cloud.dialogflow.v2.IListConversationsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listConversations.asyncIterate( - this.innerApiCalls['listConversations'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - listMessages( - request?: protos.google.cloud.dialogflow.v2.IListMessagesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IMessage[], - protos.google.cloud.dialogflow.v2.IListMessagesRequest|null, - protos.google.cloud.dialogflow.v2.IListMessagesResponse - ]>; - listMessages( - request: protos.google.cloud.dialogflow.v2.IListMessagesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListMessagesRequest, - protos.google.cloud.dialogflow.v2.IListMessagesResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IMessage>): void; - listMessages( - request: protos.google.cloud.dialogflow.v2.IListMessagesRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListMessagesRequest, - protos.google.cloud.dialogflow.v2.IListMessagesResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IMessage>): void; -/** - * Lists messages that belong to a given conversation. - * `messages` are ordered by `create_time` in descending order. To fetch - * updates without duplication, send request with filter - * `create_time_epoch_microseconds > - * [first item's create_time of previous request]` and empty page_token. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the conversation to list messages for. - * Format: `projects//locations//conversations/` - * @param {string} [request.filter] - * Optional. Filter on message fields. Currently predicates on `create_time` - * and `create_time_epoch_microseconds` are supported. `create_time` only - * support milliseconds accuracy. E.g., - * `create_time_epoch_microseconds > 1551790877964485` or - * `create_time > 2017-01-15T01:30:15.01Z`. - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [Message]{@link google.cloud.dialogflow.v2.Message}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listMessagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listMessages( - request?: protos.google.cloud.dialogflow.v2.IListMessagesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2.IListMessagesRequest, - protos.google.cloud.dialogflow.v2.IListMessagesResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IMessage>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListMessagesRequest, - protos.google.cloud.dialogflow.v2.IListMessagesResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IMessage>): - Promise<[ - protos.google.cloud.dialogflow.v2.IMessage[], - protos.google.cloud.dialogflow.v2.IListMessagesRequest|null, - protos.google.cloud.dialogflow.v2.IListMessagesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listMessages(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the conversation to list messages for. - * Format: `projects//locations//conversations/` - * @param {string} [request.filter] - * Optional. Filter on message fields. Currently predicates on `create_time` - * and `create_time_epoch_microseconds` are supported. `create_time` only - * support milliseconds accuracy. E.g., - * `create_time_epoch_microseconds > 1551790877964485` or - * `create_time > 2017-01-15T01:30:15.01Z`. - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Message]{@link google.cloud.dialogflow.v2.Message} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listMessagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listMessagesStream( - request?: protos.google.cloud.dialogflow.v2.IListMessagesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listMessages.createStream( - this.innerApiCalls.listMessages as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMessages`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the conversation to list messages for. - * Format: `projects//locations//conversations/` - * @param {string} [request.filter] - * Optional. Filter on message fields. Currently predicates on `create_time` - * and `create_time_epoch_microseconds` are supported. `create_time` only - * support milliseconds accuracy. E.g., - * `create_time_epoch_microseconds > 1551790877964485` or - * `create_time > 2017-01-15T01:30:15.01Z`. - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Message]{@link google.cloud.dialogflow.v2.Message}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listMessagesAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listMessagesAsync( - request?: protos.google.cloud.dialogflow.v2.IListMessagesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listMessages.asyncIterate( - this.innerApiCalls['listMessages'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.conversationsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/conversations_client_config.json b/owl-bot-staging/v2/src/v2/conversations_client_config.json deleted file mode 100644 index 2718600c..00000000 --- a/owl-bot-staging/v2/src/v2/conversations_client_config.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2.Conversations": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateConversation": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ListConversations": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetConversation": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CompleteConversation": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ListMessages": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/conversations_proto_list.json b/owl-bot-staging/v2/src/v2/conversations_proto_list.json deleted file mode 100644 index d2ecb25e..00000000 --- a/owl-bot-staging/v2/src/v2/conversations_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2/agent.proto", - "../../protos/google/cloud/dialogflow/v2/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2/context.proto", - "../../protos/google/cloud/dialogflow/v2/conversation.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2/document.proto", - "../../protos/google/cloud/dialogflow/v2/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/environment.proto", - "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2/gcs.proto", - "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2/intent.proto", - "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2/participant.proto", - "../../protos/google/cloud/dialogflow/v2/session.proto", - "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2/version.proto", - "../../protos/google/cloud/dialogflow/v2/webhook.proto" -] diff --git a/owl-bot-staging/v2/src/v2/documents_client.ts b/owl-bot-staging/v2/src/v2/documents_client.ts deleted file mode 100644 index f7a77bff..00000000 --- a/owl-bot-staging/v2/src/v2/documents_client.ts +++ /dev/null @@ -1,2838 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/documents_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './documents_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * Service for managing knowledge {@link google.cloud.dialogflow.v2.Document|Documents}. - * @class - * @memberof v2 - */ -export class DocumentsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - documentsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DocumentsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DocumentsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listDocuments: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'documents') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - - this.operationsClient = this._gaxModule.lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }).operationsClient(opts); - const createDocumentResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.Document') as gax.protobuf.Type; - const createDocumentMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.KnowledgeOperationMetadata') as gax.protobuf.Type; - const deleteDocumentResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteDocumentMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.KnowledgeOperationMetadata') as gax.protobuf.Type; - const updateDocumentResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.Document') as gax.protobuf.Type; - const updateDocumentMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.KnowledgeOperationMetadata') as gax.protobuf.Type; - const reloadDocumentResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.Document') as gax.protobuf.Type; - const reloadDocumentMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.KnowledgeOperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createDocument: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createDocumentResponse.decode.bind(createDocumentResponse), - createDocumentMetadata.decode.bind(createDocumentMetadata)), - deleteDocument: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteDocumentResponse.decode.bind(deleteDocumentResponse), - deleteDocumentMetadata.decode.bind(deleteDocumentMetadata)), - updateDocument: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateDocumentResponse.decode.bind(updateDocumentResponse), - updateDocumentMetadata.decode.bind(updateDocumentMetadata)), - reloadDocument: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - reloadDocumentResponse.decode.bind(reloadDocumentResponse), - reloadDocumentMetadata.decode.bind(reloadDocumentMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2.Documents', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.documentsStub) { - return this.documentsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2.Documents. - this.documentsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.Documents') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2.Documents, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const documentsStubMethods = - ['listDocuments', 'getDocument', 'createDocument', 'deleteDocument', 'updateDocument', 'reloadDocument']; - for (const methodName of documentsStubMethods) { - const callPromise = this.documentsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.documentsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getDocument( - request?: protos.google.cloud.dialogflow.v2.IGetDocumentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IDocument, - protos.google.cloud.dialogflow.v2.IGetDocumentRequest|undefined, {}|undefined - ]>; - getDocument( - request: protos.google.cloud.dialogflow.v2.IGetDocumentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IDocument, - protos.google.cloud.dialogflow.v2.IGetDocumentRequest|null|undefined, - {}|null|undefined>): void; - getDocument( - request: protos.google.cloud.dialogflow.v2.IGetDocumentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IDocument, - protos.google.cloud.dialogflow.v2.IGetDocumentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specified document. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the document to retrieve. - * 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. - * The first element of the array is an object representing [Document]{@link google.cloud.dialogflow.v2.Document}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getDocument(request); - */ - getDocument( - request?: protos.google.cloud.dialogflow.v2.IGetDocumentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IDocument, - protos.google.cloud.dialogflow.v2.IGetDocumentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IDocument, - protos.google.cloud.dialogflow.v2.IGetDocumentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IDocument, - protos.google.cloud.dialogflow.v2.IGetDocumentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getDocument(request, options, callback); - } - - createDocument( - request?: protos.google.cloud.dialogflow.v2.ICreateDocumentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createDocument( - request: protos.google.cloud.dialogflow.v2.ICreateDocumentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createDocument( - request: protos.google.cloud.dialogflow.v2.ICreateDocumentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Creates a new document. - * - * Operation - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The knowledge base to create a document for. - * Format: `projects//locations//knowledgeBases/`. - * @param {google.cloud.dialogflow.v2.Document} request.document - * Required. The document to create. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.createDocument(request); - * const [response] = await operation.promise(); - */ - createDocument( - request?: protos.google.cloud.dialogflow.v2.ICreateDocumentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createDocument(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createDocument()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkCreateDocumentProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkCreateDocumentProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createDocument, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - deleteDocument( - request?: protos.google.cloud.dialogflow.v2.IDeleteDocumentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteDocument( - request: protos.google.cloud.dialogflow.v2.IDeleteDocumentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteDocument( - request: protos.google.cloud.dialogflow.v2.IDeleteDocumentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Deletes the specified document. - * - * Operation - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the document to delete. - * 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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.deleteDocument(request); - * const [response] = await operation.promise(); - */ - deleteDocument( - request?: protos.google.cloud.dialogflow.v2.IDeleteDocumentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteDocument(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteDocument()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkDeleteDocumentProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkDeleteDocumentProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteDocument, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - updateDocument( - request?: protos.google.cloud.dialogflow.v2.IUpdateDocumentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateDocument( - request: protos.google.cloud.dialogflow.v2.IUpdateDocumentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateDocument( - request: protos.google.cloud.dialogflow.v2.IUpdateDocumentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified document. - * - * Operation - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2.Document} request.document - * Required. The document to update. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Not specified means `update all`. - * Currently, only `display_name` can be updated, an InvalidArgument will be - * returned for attempting to update other fields. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.updateDocument(request); - * const [response] = await operation.promise(); - */ - updateDocument( - request?: protos.google.cloud.dialogflow.v2.IUpdateDocumentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'document.name': request.document!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateDocument(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateDocument()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkUpdateDocumentProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkUpdateDocumentProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateDocument, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - reloadDocument( - request?: protos.google.cloud.dialogflow.v2.IReloadDocumentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - reloadDocument( - request: protos.google.cloud.dialogflow.v2.IReloadDocumentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - reloadDocument( - request: protos.google.cloud.dialogflow.v2.IReloadDocumentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Reloads the specified document from its specified source, content_uri or - * content. The previously loaded content of the document will be deleted. - * Note: Even when the content of the document has not changed, there still - * may be side effects because of internal implementation changes. - * - * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; - * only use `projects.knowledgeBases.documents`. - * - * Operation - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the document to reload. - * Format: `projects//locations//knowledgeBases//documents/` - * @param {string} [request.contentUri] - * Optional. The path of gcs source file for reloading document content. For now, - * only gcs uri is supported. - * - * For documents stored in Google Cloud Storage, these URIs must have - * the form `gs:///`. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.reloadDocument(request); - * const [response] = await operation.promise(); - */ - reloadDocument( - request?: protos.google.cloud.dialogflow.v2.IReloadDocumentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.reloadDocument(request, options, callback); - } -/** - * Check the status of the long running operation returned by `reloadDocument()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkReloadDocumentProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkReloadDocumentProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.reloadDocument, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - listDocuments( - request?: protos.google.cloud.dialogflow.v2.IListDocumentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IDocument[], - protos.google.cloud.dialogflow.v2.IListDocumentsRequest|null, - protos.google.cloud.dialogflow.v2.IListDocumentsResponse - ]>; - listDocuments( - request: protos.google.cloud.dialogflow.v2.IListDocumentsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListDocumentsRequest, - protos.google.cloud.dialogflow.v2.IListDocumentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IDocument>): void; - listDocuments( - request: protos.google.cloud.dialogflow.v2.IListDocumentsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListDocumentsRequest, - protos.google.cloud.dialogflow.v2.IListDocumentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IDocument>): void; -/** - * Returns the list of all documents of the knowledge base. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The knowledge base to list all documents for. - * 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. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [Document]{@link google.cloud.dialogflow.v2.Document}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listDocumentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listDocuments( - request?: protos.google.cloud.dialogflow.v2.IListDocumentsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2.IListDocumentsRequest, - protos.google.cloud.dialogflow.v2.IListDocumentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IDocument>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListDocumentsRequest, - protos.google.cloud.dialogflow.v2.IListDocumentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IDocument>): - Promise<[ - protos.google.cloud.dialogflow.v2.IDocument[], - protos.google.cloud.dialogflow.v2.IListDocumentsRequest|null, - protos.google.cloud.dialogflow.v2.IListDocumentsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listDocuments(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The knowledge base to list all documents for. - * 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. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Document]{@link google.cloud.dialogflow.v2.Document} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listDocumentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listDocumentsStream( - request?: protos.google.cloud.dialogflow.v2.IListDocumentsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listDocuments.createStream( - this.innerApiCalls.listDocuments as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDocuments`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The knowledge base to list all documents for. - * 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. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Document]{@link google.cloud.dialogflow.v2.Document}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listDocumentsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listDocumentsAsync( - request?: protos.google.cloud.dialogflow.v2.IListDocumentsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listDocuments.asyncIterate( - this.innerApiCalls['listDocuments'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.documentsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/documents_client_config.json b/owl-bot-staging/v2/src/v2/documents_client_config.json deleted file mode 100644 index 23bb7e66..00000000 --- a/owl-bot-staging/v2/src/v2/documents_client_config.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2.Documents": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListDocuments": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetDocument": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateDocument": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteDocument": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateDocument": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ReloadDocument": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/documents_proto_list.json b/owl-bot-staging/v2/src/v2/documents_proto_list.json deleted file mode 100644 index d2ecb25e..00000000 --- a/owl-bot-staging/v2/src/v2/documents_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2/agent.proto", - "../../protos/google/cloud/dialogflow/v2/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2/context.proto", - "../../protos/google/cloud/dialogflow/v2/conversation.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2/document.proto", - "../../protos/google/cloud/dialogflow/v2/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/environment.proto", - "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2/gcs.proto", - "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2/intent.proto", - "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2/participant.proto", - "../../protos/google/cloud/dialogflow/v2/session.proto", - "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2/version.proto", - "../../protos/google/cloud/dialogflow/v2/webhook.proto" -] diff --git a/owl-bot-staging/v2/src/v2/entity_types_client.ts b/owl-bot-staging/v2/src/v2/entity_types_client.ts deleted file mode 100644 index b5a52a81..00000000 --- a/owl-bot-staging/v2/src/v2/entity_types_client.ts +++ /dev/null @@ -1,3242 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/entity_types_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './entity_types_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2.EntityType|EntityTypes}. - * @class - * @memberof v2 - */ -export class EntityTypesClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - entityTypesStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of EntityTypesClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof EntityTypesClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listEntityTypes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'entityTypes') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - - this.operationsClient = this._gaxModule.lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }).operationsClient(opts); - const batchUpdateEntityTypesResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse') as gax.protobuf.Type; - const batchUpdateEntityTypesMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - const batchDeleteEntityTypesResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const batchDeleteEntityTypesMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - const batchCreateEntitiesResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const batchCreateEntitiesMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - const batchUpdateEntitiesResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const batchUpdateEntitiesMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - const batchDeleteEntitiesResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const batchDeleteEntitiesMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - - this.descriptors.longrunning = { - batchUpdateEntityTypes: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - batchUpdateEntityTypesResponse.decode.bind(batchUpdateEntityTypesResponse), - batchUpdateEntityTypesMetadata.decode.bind(batchUpdateEntityTypesMetadata)), - batchDeleteEntityTypes: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - batchDeleteEntityTypesResponse.decode.bind(batchDeleteEntityTypesResponse), - batchDeleteEntityTypesMetadata.decode.bind(batchDeleteEntityTypesMetadata)), - batchCreateEntities: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - batchCreateEntitiesResponse.decode.bind(batchCreateEntitiesResponse), - batchCreateEntitiesMetadata.decode.bind(batchCreateEntitiesMetadata)), - batchUpdateEntities: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - batchUpdateEntitiesResponse.decode.bind(batchUpdateEntitiesResponse), - batchUpdateEntitiesMetadata.decode.bind(batchUpdateEntitiesMetadata)), - batchDeleteEntities: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - batchDeleteEntitiesResponse.decode.bind(batchDeleteEntitiesResponse), - batchDeleteEntitiesMetadata.decode.bind(batchDeleteEntitiesMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2.EntityTypes', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.entityTypesStub) { - return this.entityTypesStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2.EntityTypes. - this.entityTypesStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.EntityTypes') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2.EntityTypes, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const entityTypesStubMethods = - ['listEntityTypes', 'getEntityType', 'createEntityType', 'updateEntityType', 'deleteEntityType', 'batchUpdateEntityTypes', 'batchDeleteEntityTypes', 'batchCreateEntities', 'batchUpdateEntities', 'batchDeleteEntities']; - for (const methodName of entityTypesStubMethods) { - const callPromise = this.entityTypesStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.entityTypesStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getEntityType( - request?: protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IEntityType, - protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest|undefined, {}|undefined - ]>; - getEntityType( - request: protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IEntityType, - protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest|null|undefined, - {}|null|undefined>): void; - getEntityType( - request: protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IEntityType, - protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specified entity type. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the entity type. - * Format: `projects//agent/entityTypes/`. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @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. - * The first element of the array is an object representing [EntityType]{@link google.cloud.dialogflow.v2.EntityType}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getEntityType(request); - */ - getEntityType( - request?: protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IEntityType, - protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IEntityType, - protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IEntityType, - protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getEntityType(request, options, callback); - } - createEntityType( - request?: protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IEntityType, - protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest|undefined, {}|undefined - ]>; - createEntityType( - request: protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IEntityType, - protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest|null|undefined, - {}|null|undefined>): void; - createEntityType( - request: protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IEntityType, - protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates an entity type in the specified agent. - * - * Note: You should always train an agent prior to sending it queries. See the - * [training - * documentation](https://cloud.google.com/dialogflow/es/docs/training). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to create a entity type for. - * Format: `projects//agent`. - * @param {google.cloud.dialogflow.v2.EntityType} request.entityType - * Required. The entity type to create. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @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. - * The first element of the array is an object representing [EntityType]{@link google.cloud.dialogflow.v2.EntityType}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createEntityType(request); - */ - createEntityType( - request?: protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IEntityType, - protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IEntityType, - protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IEntityType, - protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createEntityType(request, options, callback); - } - updateEntityType( - request?: protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IEntityType, - protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest|undefined, {}|undefined - ]>; - updateEntityType( - request: protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IEntityType, - protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest|null|undefined, - {}|null|undefined>): void; - updateEntityType( - request: protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IEntityType, - protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified entity type. - * - * Note: You should always train an agent prior to sending it queries. See the - * [training - * documentation](https://cloud.google.com/dialogflow/es/docs/training). - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2.EntityType} request.entityType - * Required. The entity type to update. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The mask to control which fields get updated. - * @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. - * The first element of the array is an object representing [EntityType]{@link google.cloud.dialogflow.v2.EntityType}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateEntityType(request); - */ - updateEntityType( - request?: protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IEntityType, - protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IEntityType, - protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IEntityType, - protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'entity_type.name': request.entityType!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateEntityType(request, options, callback); - } - deleteEntityType( - request?: protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest|undefined, {}|undefined - ]>; - deleteEntityType( - request: protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest|null|undefined, - {}|null|undefined>): void; - deleteEntityType( - request: protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deletes the specified entity type. - * - * Note: You should always train an agent prior to sending it queries. See the - * [training - * documentation](https://cloud.google.com/dialogflow/es/docs/training). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the entity type to delete. - * Format: `projects//agent/entityTypes/`. - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteEntityType(request); - */ - deleteEntityType( - request?: protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteEntityType(request, options, callback); - } - - batchUpdateEntityTypes( - request?: protos.google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - batchUpdateEntityTypes( - request: protos.google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchUpdateEntityTypes( - request: protos.google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Updates/Creates multiple entity types in the specified agent. - * - * - * Note: You should always train an agent prior to sending it queries. See the - * [training - * documentation](https://cloud.google.com/dialogflow/es/docs/training). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the agent to update or create entity types in. - * Format: `projects//agent`. - * @param {string} request.entityTypeBatchUri - * The URI to a Google Cloud Storage file containing entity types to update - * or create. The file format can either be a serialized proto (of - * EntityBatch type) or a JSON object. Note: The URI must start with - * "gs://". - * @param {google.cloud.dialogflow.v2.EntityTypeBatch} request.entityTypeBatchInline - * The collection of entity types to update or create. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The mask to control which fields get updated. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.batchUpdateEntityTypes(request); - * const [response] = await operation.promise(); - */ - batchUpdateEntityTypes( - request?: protos.google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.batchUpdateEntityTypes(request, options, callback); - } -/** - * Check the status of the long running operation returned by `batchUpdateEntityTypes()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkBatchUpdateEntityTypesProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkBatchUpdateEntityTypesProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchUpdateEntityTypes, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - batchDeleteEntityTypes( - request?: protos.google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - batchDeleteEntityTypes( - request: protos.google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchDeleteEntityTypes( - request: protos.google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Deletes entity types in the specified agent. - * - * Note: You should always train an agent prior to sending it queries. See the - * [training - * documentation](https://cloud.google.com/dialogflow/es/docs/training). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the agent to delete all entities types for. Format: - * `projects//agent`. - * @param {string[]} request.entityTypeNames - * Required. The names entity types to delete. All names must point to the - * same agent as `parent`. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.batchDeleteEntityTypes(request); - * const [response] = await operation.promise(); - */ - batchDeleteEntityTypes( - request?: protos.google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.batchDeleteEntityTypes(request, options, callback); - } -/** - * Check the status of the long running operation returned by `batchDeleteEntityTypes()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkBatchDeleteEntityTypesProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkBatchDeleteEntityTypesProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchDeleteEntityTypes, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - batchCreateEntities( - request?: protos.google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - batchCreateEntities( - request: protos.google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchCreateEntities( - request: protos.google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Creates multiple new entities in the specified entity type. - * - * Note: You should always train an agent prior to sending it queries. See the - * [training - * documentation](https://cloud.google.com/dialogflow/es/docs/training). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the entity type to create entities in. Format: - * `projects//agent/entityTypes/`. - * @param {number[]} request.entities - * Required. The entities to create. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.batchCreateEntities(request); - * const [response] = await operation.promise(); - */ - batchCreateEntities( - request?: protos.google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.batchCreateEntities(request, options, callback); - } -/** - * Check the status of the long running operation returned by `batchCreateEntities()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkBatchCreateEntitiesProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkBatchCreateEntitiesProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchCreateEntities, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - batchUpdateEntities( - request?: protos.google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - batchUpdateEntities( - request: protos.google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchUpdateEntities( - request: protos.google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Updates or creates multiple entities in the specified entity type. This - * method does not affect entities in the entity type that aren't explicitly - * specified in the request. - * - * Note: You should always train an agent prior to sending it queries. See the - * [training - * documentation](https://cloud.google.com/dialogflow/es/docs/training). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the entity type to update or create entities in. - * Format: `projects//agent/entityTypes/`. - * @param {number[]} request.entities - * Required. The entities to update or create. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The mask to control which fields get updated. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.batchUpdateEntities(request); - * const [response] = await operation.promise(); - */ - batchUpdateEntities( - request?: protos.google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.batchUpdateEntities(request, options, callback); - } -/** - * Check the status of the long running operation returned by `batchUpdateEntities()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkBatchUpdateEntitiesProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkBatchUpdateEntitiesProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchUpdateEntities, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - batchDeleteEntities( - request?: protos.google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - batchDeleteEntities( - request: protos.google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchDeleteEntities( - request: protos.google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Deletes entities in the specified entity type. - * - * Note: You should always train an agent prior to sending it queries. See the - * [training - * documentation](https://cloud.google.com/dialogflow/es/docs/training). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the entity type to delete entries for. Format: - * `projects//agent/entityTypes/`. - * @param {string[]} request.entityValues - * Required. The reference `values` of the entities to delete. Note that - * these are not fully-qualified names, i.e. they don't start with - * `projects/`. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.batchDeleteEntities(request); - * const [response] = await operation.promise(); - */ - batchDeleteEntities( - request?: protos.google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.batchDeleteEntities(request, options, callback); - } -/** - * Check the status of the long running operation returned by `batchDeleteEntities()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkBatchDeleteEntitiesProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkBatchDeleteEntitiesProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchDeleteEntities, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - listEntityTypes( - request?: protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IEntityType[], - protos.google.cloud.dialogflow.v2.IListEntityTypesRequest|null, - protos.google.cloud.dialogflow.v2.IListEntityTypesResponse - ]>; - listEntityTypes( - request: protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, - protos.google.cloud.dialogflow.v2.IListEntityTypesResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IEntityType>): void; - listEntityTypes( - request: protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, - protos.google.cloud.dialogflow.v2.IListEntityTypesResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IEntityType>): void; -/** - * Returns the list of all entity types in the specified agent. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all entity types from. - * Format: `projects//agent`. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [EntityType]{@link google.cloud.dialogflow.v2.EntityType}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listEntityTypesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listEntityTypes( - request?: protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, - protos.google.cloud.dialogflow.v2.IListEntityTypesResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IEntityType>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, - protos.google.cloud.dialogflow.v2.IListEntityTypesResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IEntityType>): - Promise<[ - protos.google.cloud.dialogflow.v2.IEntityType[], - protos.google.cloud.dialogflow.v2.IListEntityTypesRequest|null, - protos.google.cloud.dialogflow.v2.IListEntityTypesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listEntityTypes(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all entity types from. - * Format: `projects//agent`. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [EntityType]{@link google.cloud.dialogflow.v2.EntityType} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listEntityTypesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listEntityTypesStream( - request?: protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listEntityTypes.createStream( - this.innerApiCalls.listEntityTypes as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listEntityTypes`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all entity types from. - * Format: `projects//agent`. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [EntityType]{@link google.cloud.dialogflow.v2.EntityType}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listEntityTypesAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listEntityTypesAsync( - request?: protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listEntityTypes.asyncIterate( - this.innerApiCalls['listEntityTypes'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.entityTypesStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/entity_types_client_config.json b/owl-bot-staging/v2/src/v2/entity_types_client_config.json deleted file mode 100644 index 55fa4026..00000000 --- a/owl-bot-staging/v2/src/v2/entity_types_client_config.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2.EntityTypes": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListEntityTypes": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "BatchUpdateEntityTypes": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "BatchDeleteEntityTypes": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "BatchCreateEntities": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "BatchUpdateEntities": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "BatchDeleteEntities": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/entity_types_proto_list.json b/owl-bot-staging/v2/src/v2/entity_types_proto_list.json deleted file mode 100644 index d2ecb25e..00000000 --- a/owl-bot-staging/v2/src/v2/entity_types_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2/agent.proto", - "../../protos/google/cloud/dialogflow/v2/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2/context.proto", - "../../protos/google/cloud/dialogflow/v2/conversation.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2/document.proto", - "../../protos/google/cloud/dialogflow/v2/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/environment.proto", - "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2/gcs.proto", - "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2/intent.proto", - "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2/participant.proto", - "../../protos/google/cloud/dialogflow/v2/session.proto", - "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2/version.proto", - "../../protos/google/cloud/dialogflow/v2/webhook.proto" -] diff --git a/owl-bot-staging/v2/src/v2/environments_client.ts b/owl-bot-staging/v2/src/v2/environments_client.ts deleted file mode 100644 index 45715a03..00000000 --- a/owl-bot-staging/v2/src/v2/environments_client.ts +++ /dev/null @@ -1,2832 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/environments_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './environments_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2.Environment|Environments}. - * @class - * @memberof v2 - */ -export class EnvironmentsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - environmentsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of EnvironmentsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof EnvironmentsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listEnvironments: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'environments'), - getEnvironmentHistory: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'entries') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2.Environments', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.environmentsStub) { - return this.environmentsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2.Environments. - this.environmentsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.Environments') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2.Environments, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const environmentsStubMethods = - ['listEnvironments', 'getEnvironment', 'createEnvironment', 'updateEnvironment', 'deleteEnvironment', 'getEnvironmentHistory']; - for (const methodName of environmentsStubMethods) { - const callPromise = this.environmentsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.environmentsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getEnvironment( - request?: protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IEnvironment, - protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest|undefined, {}|undefined - ]>; - getEnvironment( - request: protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IEnvironment, - protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest|null|undefined, - {}|null|undefined>): void; - getEnvironment( - request: protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IEnvironment, - protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specified agent environment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the environment. - * Supported formats: - * - * - `projects//agent/environments/` - * - `projects//locations//agent/environments/` - * - * The environment ID for the default environment is `-`. - * @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. - * The first element of the array is an object representing [Environment]{@link google.cloud.dialogflow.v2.Environment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getEnvironment(request); - */ - getEnvironment( - request?: protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IEnvironment, - protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IEnvironment, - protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IEnvironment, - protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getEnvironment(request, options, callback); - } - createEnvironment( - request?: protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IEnvironment, - protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest|undefined, {}|undefined - ]>; - createEnvironment( - request: protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IEnvironment, - protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest|null|undefined, - {}|null|undefined>): void; - createEnvironment( - request: protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IEnvironment, - protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates an agent environment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to create an environment for. - * Supported formats: - * - * - `projects//agent` - * - `projects//locations//agent` - * @param {google.cloud.dialogflow.v2.Environment} request.environment - * Required. The environment to create. - * @param {string} request.environmentId - * Required. The unique id of the new environment. - * @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. - * The first element of the array is an object representing [Environment]{@link google.cloud.dialogflow.v2.Environment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createEnvironment(request); - */ - createEnvironment( - request?: protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IEnvironment, - protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IEnvironment, - protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IEnvironment, - protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createEnvironment(request, options, callback); - } - updateEnvironment( - request?: protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IEnvironment, - protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest|undefined, {}|undefined - ]>; - updateEnvironment( - request: protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IEnvironment, - protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest|null|undefined, - {}|null|undefined>): void; - updateEnvironment( - request: protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IEnvironment, - protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified agent environment. - * - * This method allows you to deploy new agent versions into the environment. - * When an environment is pointed to a new agent version by setting - * `environment.agent_version`, the environment is temporarily set to the - * `LOADING` state. During that time, the environment continues serving the - * previous version of the agent. After the new agent version is done loading, - * the environment is set back to the `RUNNING` state. - * You can use "-" as Environment ID in environment name to update an agent - * version in the default environment. WARNING: this will negate all recent - * changes to the draft agent and can't be undone. You may want to save the - * draft agent to a version before calling this method. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2.Environment} request.environment - * Required. The environment to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The mask to control which fields get updated. - * @param {boolean} [request.allowLoadToDraftAndDiscardChanges] - * Optional. This field is used to prevent accidental overwrite of the default - * environment, which is an operation that cannot be undone. To confirm that - * the caller desires this overwrite, this field must be explicitly set to - * true when updating the default environment (environment ID = `-`). - * @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. - * The first element of the array is an object representing [Environment]{@link google.cloud.dialogflow.v2.Environment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateEnvironment(request); - */ - updateEnvironment( - request?: protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IEnvironment, - protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IEnvironment, - protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IEnvironment, - protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'environment.name': request.environment!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateEnvironment(request, options, callback); - } - deleteEnvironment( - request?: protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest|undefined, {}|undefined - ]>; - deleteEnvironment( - request: protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest|null|undefined, - {}|null|undefined>): void; - deleteEnvironment( - request: protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deletes the specified agent environment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the environment to delete. - * / Format: - * - * - `projects//agent/environments/` - * - `projects//locations//agent/environments/` - * - * The environment ID for the default environment is `-`. - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteEnvironment(request); - */ - deleteEnvironment( - request?: protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteEnvironment(request, options, callback); - } - - listEnvironments( - request?: protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IEnvironment[], - protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest|null, - protos.google.cloud.dialogflow.v2.IListEnvironmentsResponse - ]>; - listEnvironments( - request: protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, - protos.google.cloud.dialogflow.v2.IListEnvironmentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IEnvironment>): void; - listEnvironments( - request: protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, - protos.google.cloud.dialogflow.v2.IListEnvironmentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IEnvironment>): void; -/** - * Returns the list of all non-default environments of the specified agent. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all environments from. - * Format: - * - * - `projects//agent` - * - `projects//locations//agent` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [Environment]{@link google.cloud.dialogflow.v2.Environment}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listEnvironmentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listEnvironments( - request?: protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, - protos.google.cloud.dialogflow.v2.IListEnvironmentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IEnvironment>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, - protos.google.cloud.dialogflow.v2.IListEnvironmentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IEnvironment>): - Promise<[ - protos.google.cloud.dialogflow.v2.IEnvironment[], - protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest|null, - protos.google.cloud.dialogflow.v2.IListEnvironmentsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listEnvironments(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all environments from. - * Format: - * - * - `projects//agent` - * - `projects//locations//agent` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Environment]{@link google.cloud.dialogflow.v2.Environment} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listEnvironmentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listEnvironmentsStream( - request?: protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listEnvironments.createStream( - this.innerApiCalls.listEnvironments as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listEnvironments`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all environments from. - * Format: - * - * - `projects//agent` - * - `projects//locations//agent` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Environment]{@link google.cloud.dialogflow.v2.Environment}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listEnvironmentsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listEnvironmentsAsync( - request?: protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listEnvironments.asyncIterate( - this.innerApiCalls['listEnvironments'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - getEnvironmentHistory( - request?: protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry[], - protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest|null, - protos.google.cloud.dialogflow.v2.IEnvironmentHistory - ]>; - getEnvironmentHistory( - request: protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, - protos.google.cloud.dialogflow.v2.IEnvironmentHistory|null|undefined, - protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry>): void; - getEnvironmentHistory( - request: protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, - protos.google.cloud.dialogflow.v2.IEnvironmentHistory|null|undefined, - protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry>): void; -/** - * Gets the history of the specified environment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the environment to retrieve history for. - * Supported formats: - * - * - `projects//agent/environments/` - * - `projects//locations//agent/environments/` - * - * The environment ID for the default environment is `-`. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [Entry]{@link google.cloud.dialogflow.v2.EnvironmentHistory.Entry}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `getEnvironmentHistoryAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - getEnvironmentHistory( - request?: protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, - protos.google.cloud.dialogflow.v2.IEnvironmentHistory|null|undefined, - protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, - protos.google.cloud.dialogflow.v2.IEnvironmentHistory|null|undefined, - protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry>): - Promise<[ - protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry[], - protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest|null, - protos.google.cloud.dialogflow.v2.IEnvironmentHistory - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.getEnvironmentHistory(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the environment to retrieve history for. - * Supported formats: - * - * - `projects//agent/environments/` - * - `projects//locations//agent/environments/` - * - * The environment ID for the default environment is `-`. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Entry]{@link google.cloud.dialogflow.v2.EnvironmentHistory.Entry} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `getEnvironmentHistoryAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - getEnvironmentHistoryStream( - request?: protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.getEnvironmentHistory.createStream( - this.innerApiCalls.getEnvironmentHistory as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `getEnvironmentHistory`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the environment to retrieve history for. - * Supported formats: - * - * - `projects//agent/environments/` - * - `projects//locations//agent/environments/` - * - * The environment ID for the default environment is `-`. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Entry]{@link google.cloud.dialogflow.v2.EnvironmentHistory.Entry}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.getEnvironmentHistoryAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - getEnvironmentHistoryAsync( - request?: protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.getEnvironmentHistory.asyncIterate( - this.innerApiCalls['getEnvironmentHistory'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.environmentsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/environments_client_config.json b/owl-bot-staging/v2/src/v2/environments_client_config.json deleted file mode 100644 index 30cdbacb..00000000 --- a/owl-bot-staging/v2/src/v2/environments_client_config.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2.Environments": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListEnvironments": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetEnvironment": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateEnvironment": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateEnvironment": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteEnvironment": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetEnvironmentHistory": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/environments_proto_list.json b/owl-bot-staging/v2/src/v2/environments_proto_list.json deleted file mode 100644 index d2ecb25e..00000000 --- a/owl-bot-staging/v2/src/v2/environments_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2/agent.proto", - "../../protos/google/cloud/dialogflow/v2/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2/context.proto", - "../../protos/google/cloud/dialogflow/v2/conversation.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2/document.proto", - "../../protos/google/cloud/dialogflow/v2/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/environment.proto", - "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2/gcs.proto", - "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2/intent.proto", - "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2/participant.proto", - "../../protos/google/cloud/dialogflow/v2/session.proto", - "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2/version.proto", - "../../protos/google/cloud/dialogflow/v2/webhook.proto" -] diff --git a/owl-bot-staging/v2/src/v2/fulfillments_client.ts b/owl-bot-staging/v2/src/v2/fulfillments_client.ts deleted file mode 100644 index 0efed62f..00000000 --- a/owl-bot-staging/v2/src/v2/fulfillments_client.ts +++ /dev/null @@ -1,2226 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/fulfillments_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './fulfillments_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2.Fulfillment|Fulfillments}. - * @class - * @memberof v2 - */ -export class FulfillmentsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - fulfillmentsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of FulfillmentsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof FulfillmentsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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}' - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2.Fulfillments', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.fulfillmentsStub) { - return this.fulfillmentsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2.Fulfillments. - this.fulfillmentsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.Fulfillments') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2.Fulfillments, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const fulfillmentsStubMethods = - ['getFulfillment', 'updateFulfillment']; - for (const methodName of fulfillmentsStubMethods) { - const callPromise = this.fulfillmentsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.fulfillmentsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getFulfillment( - request?: protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IFulfillment, - protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest|undefined, {}|undefined - ]>; - getFulfillment( - request: protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IFulfillment, - protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest|null|undefined, - {}|null|undefined>): void; - getFulfillment( - request: protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IFulfillment, - protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the fulfillment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the fulfillment. - * Format: `projects//agent/fulfillment`. - * @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. - * The first element of the array is an object representing [Fulfillment]{@link google.cloud.dialogflow.v2.Fulfillment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getFulfillment(request); - */ - getFulfillment( - request?: protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IFulfillment, - protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IFulfillment, - protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IFulfillment, - protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getFulfillment(request, options, callback); - } - updateFulfillment( - request?: protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IFulfillment, - protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest|undefined, {}|undefined - ]>; - updateFulfillment( - request: protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IFulfillment, - protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest|null|undefined, - {}|null|undefined>): void; - updateFulfillment( - request: protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IFulfillment, - protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the fulfillment. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2.Fulfillment} request.fulfillment - * Required. The fulfillment to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The mask to control which fields get updated. If the mask is not - * present, all fields will be updated. - * @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. - * The first element of the array is an object representing [Fulfillment]{@link google.cloud.dialogflow.v2.Fulfillment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateFulfillment(request); - */ - updateFulfillment( - request?: protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IFulfillment, - protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IFulfillment, - protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IFulfillment, - protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'fulfillment.name': request.fulfillment!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateFulfillment(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.fulfillmentsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/fulfillments_client_config.json b/owl-bot-staging/v2/src/v2/fulfillments_client_config.json deleted file mode 100644 index 615e86fe..00000000 --- a/owl-bot-staging/v2/src/v2/fulfillments_client_config.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2.Fulfillments": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetFulfillment": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateFulfillment": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/fulfillments_proto_list.json b/owl-bot-staging/v2/src/v2/fulfillments_proto_list.json deleted file mode 100644 index d2ecb25e..00000000 --- a/owl-bot-staging/v2/src/v2/fulfillments_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2/agent.proto", - "../../protos/google/cloud/dialogflow/v2/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2/context.proto", - "../../protos/google/cloud/dialogflow/v2/conversation.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2/document.proto", - "../../protos/google/cloud/dialogflow/v2/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/environment.proto", - "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2/gcs.proto", - "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2/intent.proto", - "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2/participant.proto", - "../../protos/google/cloud/dialogflow/v2/session.proto", - "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2/version.proto", - "../../protos/google/cloud/dialogflow/v2/webhook.proto" -] diff --git a/owl-bot-staging/v2/src/v2/gapic_metadata.json b/owl-bot-staging/v2/src/v2/gapic_metadata.json deleted file mode 100644 index 56df6aa2..00000000 --- a/owl-bot-staging/v2/src/v2/gapic_metadata.json +++ /dev/null @@ -1,1094 +0,0 @@ -{ - "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" - ] - } - } - } - } - }, - "AnswerRecords": { - "clients": { - "grpc": { - "libraryClient": "AnswerRecordsClient", - "rpcs": { - "UpdateAnswerRecord": { - "methods": [ - "updateAnswerRecord" - ] - }, - "ListAnswerRecords": { - "methods": [ - "listAnswerRecords", - "listAnswerRecordsStream", - "listAnswerRecordsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "AnswerRecordsClient", - "rpcs": { - "UpdateAnswerRecord": { - "methods": [ - "updateAnswerRecord" - ] - }, - "ListAnswerRecords": { - "methods": [ - "listAnswerRecords", - "listAnswerRecordsStream", - "listAnswerRecordsAsync" - ] - } - } - } - } - }, - "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" - ] - } - } - } - } - }, - "ConversationProfiles": { - "clients": { - "grpc": { - "libraryClient": "ConversationProfilesClient", - "rpcs": { - "GetConversationProfile": { - "methods": [ - "getConversationProfile" - ] - }, - "CreateConversationProfile": { - "methods": [ - "createConversationProfile" - ] - }, - "UpdateConversationProfile": { - "methods": [ - "updateConversationProfile" - ] - }, - "DeleteConversationProfile": { - "methods": [ - "deleteConversationProfile" - ] - }, - "ListConversationProfiles": { - "methods": [ - "listConversationProfiles", - "listConversationProfilesStream", - "listConversationProfilesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ConversationProfilesClient", - "rpcs": { - "GetConversationProfile": { - "methods": [ - "getConversationProfile" - ] - }, - "CreateConversationProfile": { - "methods": [ - "createConversationProfile" - ] - }, - "UpdateConversationProfile": { - "methods": [ - "updateConversationProfile" - ] - }, - "DeleteConversationProfile": { - "methods": [ - "deleteConversationProfile" - ] - }, - "ListConversationProfiles": { - "methods": [ - "listConversationProfiles", - "listConversationProfilesStream", - "listConversationProfilesAsync" - ] - } - } - } - } - }, - "Conversations": { - "clients": { - "grpc": { - "libraryClient": "ConversationsClient", - "rpcs": { - "CreateConversation": { - "methods": [ - "createConversation" - ] - }, - "GetConversation": { - "methods": [ - "getConversation" - ] - }, - "CompleteConversation": { - "methods": [ - "completeConversation" - ] - }, - "ListConversations": { - "methods": [ - "listConversations", - "listConversationsStream", - "listConversationsAsync" - ] - }, - "ListMessages": { - "methods": [ - "listMessages", - "listMessagesStream", - "listMessagesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ConversationsClient", - "rpcs": { - "CreateConversation": { - "methods": [ - "createConversation" - ] - }, - "GetConversation": { - "methods": [ - "getConversation" - ] - }, - "CompleteConversation": { - "methods": [ - "completeConversation" - ] - }, - "ListConversations": { - "methods": [ - "listConversations", - "listConversationsStream", - "listConversationsAsync" - ] - }, - "ListMessages": { - "methods": [ - "listMessages", - "listMessagesStream", - "listMessagesAsync" - ] - } - } - } - } - }, - "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": { - "GetEnvironment": { - "methods": [ - "getEnvironment" - ] - }, - "CreateEnvironment": { - "methods": [ - "createEnvironment" - ] - }, - "UpdateEnvironment": { - "methods": [ - "updateEnvironment" - ] - }, - "DeleteEnvironment": { - "methods": [ - "deleteEnvironment" - ] - }, - "ListEnvironments": { - "methods": [ - "listEnvironments", - "listEnvironmentsStream", - "listEnvironmentsAsync" - ] - }, - "GetEnvironmentHistory": { - "methods": [ - "getEnvironmentHistory", - "getEnvironmentHistoryStream", - "getEnvironmentHistoryAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "EnvironmentsClient", - "rpcs": { - "GetEnvironment": { - "methods": [ - "getEnvironment" - ] - }, - "CreateEnvironment": { - "methods": [ - "createEnvironment" - ] - }, - "UpdateEnvironment": { - "methods": [ - "updateEnvironment" - ] - }, - "DeleteEnvironment": { - "methods": [ - "deleteEnvironment" - ] - }, - "ListEnvironments": { - "methods": [ - "listEnvironments", - "listEnvironmentsStream", - "listEnvironmentsAsync" - ] - }, - "GetEnvironmentHistory": { - "methods": [ - "getEnvironmentHistory", - "getEnvironmentHistoryStream", - "getEnvironmentHistoryAsync" - ] - } - } - } - } - }, - "Fulfillments": { - "clients": { - "grpc": { - "libraryClient": "FulfillmentsClient", - "rpcs": { - "GetFulfillment": { - "methods": [ - "getFulfillment" - ] - }, - "UpdateFulfillment": { - "methods": [ - "updateFulfillment" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "FulfillmentsClient", - "rpcs": { - "GetFulfillment": { - "methods": [ - "getFulfillment" - ] - }, - "UpdateFulfillment": { - "methods": [ - "updateFulfillment" - ] - } - } - } - } - }, - "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" - ] - } - } - } - } - }, - "Participants": { - "clients": { - "grpc": { - "libraryClient": "ParticipantsClient", - "rpcs": { - "CreateParticipant": { - "methods": [ - "createParticipant" - ] - }, - "GetParticipant": { - "methods": [ - "getParticipant" - ] - }, - "UpdateParticipant": { - "methods": [ - "updateParticipant" - ] - }, - "AnalyzeContent": { - "methods": [ - "analyzeContent" - ] - }, - "SuggestArticles": { - "methods": [ - "suggestArticles" - ] - }, - "SuggestFaqAnswers": { - "methods": [ - "suggestFaqAnswers" - ] - }, - "ListParticipants": { - "methods": [ - "listParticipants", - "listParticipantsStream", - "listParticipantsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ParticipantsClient", - "rpcs": { - "CreateParticipant": { - "methods": [ - "createParticipant" - ] - }, - "GetParticipant": { - "methods": [ - "getParticipant" - ] - }, - "UpdateParticipant": { - "methods": [ - "updateParticipant" - ] - }, - "AnalyzeContent": { - "methods": [ - "analyzeContent" - ] - }, - "SuggestArticles": { - "methods": [ - "suggestArticles" - ] - }, - "SuggestFaqAnswers": { - "methods": [ - "suggestFaqAnswers" - ] - }, - "ListParticipants": { - "methods": [ - "listParticipants", - "listParticipantsStream", - "listParticipantsAsync" - ] - } - } - } - } - }, - "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" - ] - } - } - } - } - }, - "Versions": { - "clients": { - "grpc": { - "libraryClient": "VersionsClient", - "rpcs": { - "GetVersion": { - "methods": [ - "getVersion" - ] - }, - "CreateVersion": { - "methods": [ - "createVersion" - ] - }, - "UpdateVersion": { - "methods": [ - "updateVersion" - ] - }, - "DeleteVersion": { - "methods": [ - "deleteVersion" - ] - }, - "ListVersions": { - "methods": [ - "listVersions", - "listVersionsStream", - "listVersionsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "VersionsClient", - "rpcs": { - "GetVersion": { - "methods": [ - "getVersion" - ] - }, - "CreateVersion": { - "methods": [ - "createVersion" - ] - }, - "UpdateVersion": { - "methods": [ - "updateVersion" - ] - }, - "DeleteVersion": { - "methods": [ - "deleteVersion" - ] - }, - "ListVersions": { - "methods": [ - "listVersions", - "listVersionsStream", - "listVersionsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/index.ts b/owl-bot-staging/v2/src/v2/index.ts deleted file mode 100644 index 7214e5d9..00000000 --- a/owl-bot-staging/v2/src/v2/index.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {AgentsClient} from './agents_client'; -export {AnswerRecordsClient} from './answer_records_client'; -export {ContextsClient} from './contexts_client'; -export {ConversationProfilesClient} from './conversation_profiles_client'; -export {ConversationsClient} from './conversations_client'; -export {DocumentsClient} from './documents_client'; -export {EntityTypesClient} from './entity_types_client'; -export {EnvironmentsClient} from './environments_client'; -export {FulfillmentsClient} from './fulfillments_client'; -export {IntentsClient} from './intents_client'; -export {KnowledgeBasesClient} from './knowledge_bases_client'; -export {ParticipantsClient} from './participants_client'; -export {SessionEntityTypesClient} from './session_entity_types_client'; -export {SessionsClient} from './sessions_client'; -export {VersionsClient} from './versions_client'; diff --git a/owl-bot-staging/v2/src/v2/intents_client.ts b/owl-bot-staging/v2/src/v2/intents_client.ts deleted file mode 100644 index 368ae75c..00000000 --- a/owl-bot-staging/v2/src/v2/intents_client.ts +++ /dev/null @@ -1,2927 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/intents_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './intents_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2.Intent|Intents}. - * @class - * @memberof v2 - */ -export class IntentsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - intentsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of IntentsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof IntentsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listIntents: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'intents') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - - this.operationsClient = this._gaxModule.lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }).operationsClient(opts); - const batchUpdateIntentsResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.BatchUpdateIntentsResponse') as gax.protobuf.Type; - const batchUpdateIntentsMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - const batchDeleteIntentsResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const batchDeleteIntentsMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - - this.descriptors.longrunning = { - batchUpdateIntents: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - batchUpdateIntentsResponse.decode.bind(batchUpdateIntentsResponse), - batchUpdateIntentsMetadata.decode.bind(batchUpdateIntentsMetadata)), - batchDeleteIntents: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - batchDeleteIntentsResponse.decode.bind(batchDeleteIntentsResponse), - batchDeleteIntentsMetadata.decode.bind(batchDeleteIntentsMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2.Intents', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.intentsStub) { - return this.intentsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2.Intents. - this.intentsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.Intents') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2.Intents, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const intentsStubMethods = - ['listIntents', 'getIntent', 'createIntent', 'updateIntent', 'deleteIntent', 'batchUpdateIntents', 'batchDeleteIntents']; - for (const methodName of intentsStubMethods) { - const callPromise = this.intentsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.intentsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getIntent( - request?: protos.google.cloud.dialogflow.v2.IGetIntentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IIntent, - protos.google.cloud.dialogflow.v2.IGetIntentRequest|undefined, {}|undefined - ]>; - getIntent( - request: protos.google.cloud.dialogflow.v2.IGetIntentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IIntent, - protos.google.cloud.dialogflow.v2.IGetIntentRequest|null|undefined, - {}|null|undefined>): void; - getIntent( - request: protos.google.cloud.dialogflow.v2.IGetIntentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IIntent, - protos.google.cloud.dialogflow.v2.IGetIntentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specified intent. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the intent. - * Format: `projects//agent/intents/`. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] - * Optional. The resource view to apply to the returned intent. - * @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. - * The first element of the array is an object representing [Intent]{@link google.cloud.dialogflow.v2.Intent}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getIntent(request); - */ - getIntent( - request?: protos.google.cloud.dialogflow.v2.IGetIntentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IIntent, - protos.google.cloud.dialogflow.v2.IGetIntentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IIntent, - protos.google.cloud.dialogflow.v2.IGetIntentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IIntent, - protos.google.cloud.dialogflow.v2.IGetIntentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getIntent(request, options, callback); - } - createIntent( - request?: protos.google.cloud.dialogflow.v2.ICreateIntentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IIntent, - protos.google.cloud.dialogflow.v2.ICreateIntentRequest|undefined, {}|undefined - ]>; - createIntent( - request: protos.google.cloud.dialogflow.v2.ICreateIntentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IIntent, - protos.google.cloud.dialogflow.v2.ICreateIntentRequest|null|undefined, - {}|null|undefined>): void; - createIntent( - request: protos.google.cloud.dialogflow.v2.ICreateIntentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IIntent, - protos.google.cloud.dialogflow.v2.ICreateIntentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates an intent in the specified agent. - * - * Note: You should always train an agent prior to sending it queries. See the - * [training - * documentation](https://cloud.google.com/dialogflow/es/docs/training). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to create a intent for. - * Format: `projects//agent`. - * @param {google.cloud.dialogflow.v2.Intent} request.intent - * Required. The intent to create. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] - * Optional. The resource view to apply to the returned intent. - * @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. - * The first element of the array is an object representing [Intent]{@link google.cloud.dialogflow.v2.Intent}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createIntent(request); - */ - createIntent( - request?: protos.google.cloud.dialogflow.v2.ICreateIntentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IIntent, - protos.google.cloud.dialogflow.v2.ICreateIntentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IIntent, - protos.google.cloud.dialogflow.v2.ICreateIntentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IIntent, - protos.google.cloud.dialogflow.v2.ICreateIntentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createIntent(request, options, callback); - } - updateIntent( - request?: protos.google.cloud.dialogflow.v2.IUpdateIntentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IIntent, - protos.google.cloud.dialogflow.v2.IUpdateIntentRequest|undefined, {}|undefined - ]>; - updateIntent( - request: protos.google.cloud.dialogflow.v2.IUpdateIntentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IIntent, - protos.google.cloud.dialogflow.v2.IUpdateIntentRequest|null|undefined, - {}|null|undefined>): void; - updateIntent( - request: protos.google.cloud.dialogflow.v2.IUpdateIntentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IIntent, - protos.google.cloud.dialogflow.v2.IUpdateIntentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified intent. - * - * Note: You should always train an agent prior to sending it queries. See the - * [training - * documentation](https://cloud.google.com/dialogflow/es/docs/training). - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2.Intent} request.intent - * Required. The intent to update. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The mask to control which fields get updated. - * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] - * Optional. The resource view to apply to the returned intent. - * @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. - * The first element of the array is an object representing [Intent]{@link google.cloud.dialogflow.v2.Intent}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateIntent(request); - */ - updateIntent( - request?: protos.google.cloud.dialogflow.v2.IUpdateIntentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IIntent, - protos.google.cloud.dialogflow.v2.IUpdateIntentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IIntent, - protos.google.cloud.dialogflow.v2.IUpdateIntentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IIntent, - protos.google.cloud.dialogflow.v2.IUpdateIntentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'intent.name': request.intent!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateIntent(request, options, callback); - } - deleteIntent( - request?: protos.google.cloud.dialogflow.v2.IDeleteIntentRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteIntentRequest|undefined, {}|undefined - ]>; - deleteIntent( - request: protos.google.cloud.dialogflow.v2.IDeleteIntentRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteIntentRequest|null|undefined, - {}|null|undefined>): void; - deleteIntent( - request: protos.google.cloud.dialogflow.v2.IDeleteIntentRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteIntentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deletes the specified intent and its direct or indirect followup intents. - * - * Note: You should always train an agent prior to sending it queries. See the - * [training - * documentation](https://cloud.google.com/dialogflow/es/docs/training). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the intent to delete. If this intent has direct or - * indirect followup intents, we also delete them. - * Format: `projects//agent/intents/`. - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteIntent(request); - */ - deleteIntent( - request?: protos.google.cloud.dialogflow.v2.IDeleteIntentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteIntentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteIntentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteIntentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteIntent(request, options, callback); - } - - batchUpdateIntents( - request?: protos.google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - batchUpdateIntents( - request: protos.google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchUpdateIntents( - request: protos.google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Updates/Creates multiple intents in the specified agent. - * - * - * Note: You should always train an agent prior to sending it queries. See the - * [training - * documentation](https://cloud.google.com/dialogflow/es/docs/training). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the agent to update or create intents in. - * Format: `projects//agent`. - * @param {string} request.intentBatchUri - * The URI to a Google Cloud Storage file containing intents to update or - * create. The file format can either be a serialized proto (of IntentBatch - * type) or JSON object. Note: The URI must start with "gs://". - * @param {google.cloud.dialogflow.v2.IntentBatch} request.intentBatchInline - * The collection of intents to update or create. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The mask to control which fields get updated. - * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] - * Optional. The resource view to apply to the returned intent. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.batchUpdateIntents(request); - * const [response] = await operation.promise(); - */ - batchUpdateIntents( - request?: protos.google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.batchUpdateIntents(request, options, callback); - } -/** - * Check the status of the long running operation returned by `batchUpdateIntents()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkBatchUpdateIntentsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkBatchUpdateIntentsProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchUpdateIntents, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - batchDeleteIntents( - request?: protos.google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - batchDeleteIntents( - request: protos.google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchDeleteIntents( - request: protos.google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Deletes intents in the specified agent. - * - * - * Note: You should always train an agent prior to sending it queries. See the - * [training - * documentation](https://cloud.google.com/dialogflow/es/docs/training). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the agent to delete all entities types for. Format: - * `projects//agent`. - * @param {number[]} request.intents - * Required. The collection of intents to delete. Only intent `name` must be - * filled in. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.batchDeleteIntents(request); - * const [response] = await operation.promise(); - */ - batchDeleteIntents( - request?: protos.google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.batchDeleteIntents(request, options, callback); - } -/** - * Check the status of the long running operation returned by `batchDeleteIntents()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkBatchDeleteIntentsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkBatchDeleteIntentsProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchDeleteIntents, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - listIntents( - request?: protos.google.cloud.dialogflow.v2.IListIntentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IIntent[], - protos.google.cloud.dialogflow.v2.IListIntentsRequest|null, - protos.google.cloud.dialogflow.v2.IListIntentsResponse - ]>; - listIntents( - request: protos.google.cloud.dialogflow.v2.IListIntentsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListIntentsRequest, - protos.google.cloud.dialogflow.v2.IListIntentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IIntent>): void; - listIntents( - request: protos.google.cloud.dialogflow.v2.IListIntentsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListIntentsRequest, - protos.google.cloud.dialogflow.v2.IListIntentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IIntent>): void; -/** - * Returns the list of all intents in the specified agent. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all intents from. - * Format: `projects//agent` or `projects//locations//agent`. - * - * Alternatively, you can specify the environment to list intents for. - * Format: `projects//agent/environments/` - * or `projects//locations//agent/environments/`. - * Note: training phrases of the intents will not be returned for non-draft - * environment. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] - * Optional. The resource view to apply to the returned intent. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [Intent]{@link google.cloud.dialogflow.v2.Intent}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listIntentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listIntents( - request?: protos.google.cloud.dialogflow.v2.IListIntentsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2.IListIntentsRequest, - protos.google.cloud.dialogflow.v2.IListIntentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IIntent>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListIntentsRequest, - protos.google.cloud.dialogflow.v2.IListIntentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IIntent>): - Promise<[ - protos.google.cloud.dialogflow.v2.IIntent[], - protos.google.cloud.dialogflow.v2.IListIntentsRequest|null, - protos.google.cloud.dialogflow.v2.IListIntentsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listIntents(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all intents from. - * Format: `projects//agent` or `projects//locations//agent`. - * - * Alternatively, you can specify the environment to list intents for. - * Format: `projects//agent/environments/` - * or `projects//locations//agent/environments/`. - * Note: training phrases of the intents will not be returned for non-draft - * environment. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] - * Optional. The resource view to apply to the returned intent. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Intent]{@link google.cloud.dialogflow.v2.Intent} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listIntentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listIntentsStream( - request?: protos.google.cloud.dialogflow.v2.IListIntentsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listIntents.createStream( - this.innerApiCalls.listIntents as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listIntents`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all intents from. - * Format: `projects//agent` or `projects//locations//agent`. - * - * Alternatively, you can specify the environment to list intents for. - * Format: `projects//agent/environments/` - * or `projects//locations//agent/environments/`. - * Note: training phrases of the intents will not be returned for non-draft - * environment. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] - * Optional. The resource view to apply to the returned intent. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Intent]{@link google.cloud.dialogflow.v2.Intent}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listIntentsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listIntentsAsync( - request?: protos.google.cloud.dialogflow.v2.IListIntentsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listIntents.asyncIterate( - this.innerApiCalls['listIntents'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.intentsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/intents_client_config.json b/owl-bot-staging/v2/src/v2/intents_client_config.json deleted file mode 100644 index ad20f4c6..00000000 --- a/owl-bot-staging/v2/src/v2/intents_client_config.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2.Intents": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListIntents": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetIntent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateIntent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateIntent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteIntent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "BatchUpdateIntents": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "BatchDeleteIntents": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/intents_proto_list.json b/owl-bot-staging/v2/src/v2/intents_proto_list.json deleted file mode 100644 index d2ecb25e..00000000 --- a/owl-bot-staging/v2/src/v2/intents_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2/agent.proto", - "../../protos/google/cloud/dialogflow/v2/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2/context.proto", - "../../protos/google/cloud/dialogflow/v2/conversation.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2/document.proto", - "../../protos/google/cloud/dialogflow/v2/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/environment.proto", - "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2/gcs.proto", - "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2/intent.proto", - "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2/participant.proto", - "../../protos/google/cloud/dialogflow/v2/session.proto", - "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2/version.proto", - "../../protos/google/cloud/dialogflow/v2/webhook.proto" -] diff --git a/owl-bot-staging/v2/src/v2/knowledge_bases_client.ts b/owl-bot-staging/v2/src/v2/knowledge_bases_client.ts deleted file mode 100644 index b93c6666..00000000 --- a/owl-bot-staging/v2/src/v2/knowledge_bases_client.ts +++ /dev/null @@ -1,2596 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/knowledge_bases_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './knowledge_bases_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2.KnowledgeBase|KnowledgeBases}. - * @class - * @memberof v2 - */ -export class KnowledgeBasesClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - knowledgeBasesStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of KnowledgeBasesClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof KnowledgeBasesClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listKnowledgeBases: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'knowledgeBases') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2.KnowledgeBases', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.knowledgeBasesStub) { - return this.knowledgeBasesStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2.KnowledgeBases. - this.knowledgeBasesStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.KnowledgeBases') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2.KnowledgeBases, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const knowledgeBasesStubMethods = - ['listKnowledgeBases', 'getKnowledgeBase', 'createKnowledgeBase', 'deleteKnowledgeBase', 'updateKnowledgeBase']; - for (const methodName of knowledgeBasesStubMethods) { - const callPromise = this.knowledgeBasesStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.knowledgeBasesStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getKnowledgeBase( - request?: protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IKnowledgeBase, - protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest|undefined, {}|undefined - ]>; - getKnowledgeBase( - request: protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IKnowledgeBase, - protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): void; - getKnowledgeBase( - request: protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IKnowledgeBase, - protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specified knowledge base. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the knowledge base to retrieve. - * 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. - * The first element of the array is an object representing [KnowledgeBase]{@link google.cloud.dialogflow.v2.KnowledgeBase}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getKnowledgeBase(request); - */ - getKnowledgeBase( - request?: protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IKnowledgeBase, - protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IKnowledgeBase, - protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IKnowledgeBase, - protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getKnowledgeBase(request, options, callback); - } - createKnowledgeBase( - request?: protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IKnowledgeBase, - protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest|undefined, {}|undefined - ]>; - createKnowledgeBase( - request: protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IKnowledgeBase, - protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): void; - createKnowledgeBase( - request: protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IKnowledgeBase, - protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates a knowledge base. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to create a knowledge base for. - * Format: `projects//locations/`. - * @param {google.cloud.dialogflow.v2.KnowledgeBase} request.knowledgeBase - * Required. The knowledge base to create. - * @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. - * The first element of the array is an object representing [KnowledgeBase]{@link google.cloud.dialogflow.v2.KnowledgeBase}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createKnowledgeBase(request); - */ - createKnowledgeBase( - request?: protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IKnowledgeBase, - protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IKnowledgeBase, - protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IKnowledgeBase, - protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createKnowledgeBase(request, options, callback); - } - deleteKnowledgeBase( - request?: protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest|undefined, {}|undefined - ]>; - deleteKnowledgeBase( - request: protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): void; - deleteKnowledgeBase( - request: protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deletes the specified knowledge base. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the knowledge base to delete. - * 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. - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteKnowledgeBase(request); - */ - deleteKnowledgeBase( - request?: protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteKnowledgeBase(request, options, callback); - } - updateKnowledgeBase( - request?: protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IKnowledgeBase, - protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest|undefined, {}|undefined - ]>; - updateKnowledgeBase( - request: protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IKnowledgeBase, - protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): void; - updateKnowledgeBase( - request: protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IKnowledgeBase, - protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified knowledge base. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2.KnowledgeBase} request.knowledgeBase - * Required. The knowledge base to update. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Not specified means `update all`. - * Currently, only `display_name` can be updated, an InvalidArgument will be - * returned for attempting to update other fields. - * @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. - * The first element of the array is an object representing [KnowledgeBase]{@link google.cloud.dialogflow.v2.KnowledgeBase}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateKnowledgeBase(request); - */ - updateKnowledgeBase( - request?: protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IKnowledgeBase, - protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IKnowledgeBase, - protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IKnowledgeBase, - protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'knowledge_base.name': request.knowledgeBase!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateKnowledgeBase(request, options, callback); - } - - listKnowledgeBases( - request?: protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IKnowledgeBase[], - protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest|null, - protos.google.cloud.dialogflow.v2.IListKnowledgeBasesResponse - ]>; - listKnowledgeBases( - request: protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, - protos.google.cloud.dialogflow.v2.IListKnowledgeBasesResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IKnowledgeBase>): void; - listKnowledgeBases( - request: protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, - protos.google.cloud.dialogflow.v2.IListKnowledgeBasesResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IKnowledgeBase>): void; -/** - * Returns the list of all knowledge bases of the specified agent. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list of knowledge bases for. - * 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. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [KnowledgeBase]{@link google.cloud.dialogflow.v2.KnowledgeBase}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listKnowledgeBasesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listKnowledgeBases( - request?: protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, - protos.google.cloud.dialogflow.v2.IListKnowledgeBasesResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IKnowledgeBase>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, - protos.google.cloud.dialogflow.v2.IListKnowledgeBasesResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IKnowledgeBase>): - Promise<[ - protos.google.cloud.dialogflow.v2.IKnowledgeBase[], - protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest|null, - protos.google.cloud.dialogflow.v2.IListKnowledgeBasesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listKnowledgeBases(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list of knowledge bases for. - * 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. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [KnowledgeBase]{@link google.cloud.dialogflow.v2.KnowledgeBase} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listKnowledgeBasesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listKnowledgeBasesStream( - request?: protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listKnowledgeBases.createStream( - this.innerApiCalls.listKnowledgeBases as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listKnowledgeBases`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list of knowledge bases for. - * 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. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [KnowledgeBase]{@link google.cloud.dialogflow.v2.KnowledgeBase}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listKnowledgeBasesAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listKnowledgeBasesAsync( - request?: protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listKnowledgeBases.asyncIterate( - this.innerApiCalls['listKnowledgeBases'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.knowledgeBasesStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/knowledge_bases_client_config.json b/owl-bot-staging/v2/src/v2/knowledge_bases_client_config.json deleted file mode 100644 index 580ef4d8..00000000 --- a/owl-bot-staging/v2/src/v2/knowledge_bases_client_config.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2.KnowledgeBases": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListKnowledgeBases": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetKnowledgeBase": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateKnowledgeBase": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteKnowledgeBase": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateKnowledgeBase": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/knowledge_bases_proto_list.json b/owl-bot-staging/v2/src/v2/knowledge_bases_proto_list.json deleted file mode 100644 index d2ecb25e..00000000 --- a/owl-bot-staging/v2/src/v2/knowledge_bases_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2/agent.proto", - "../../protos/google/cloud/dialogflow/v2/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2/context.proto", - "../../protos/google/cloud/dialogflow/v2/conversation.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2/document.proto", - "../../protos/google/cloud/dialogflow/v2/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/environment.proto", - "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2/gcs.proto", - "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2/intent.proto", - "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2/participant.proto", - "../../protos/google/cloud/dialogflow/v2/session.proto", - "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2/version.proto", - "../../protos/google/cloud/dialogflow/v2/webhook.proto" -] diff --git a/owl-bot-staging/v2/src/v2/participants_client.ts b/owl-bot-staging/v2/src/v2/participants_client.ts deleted file mode 100644 index dd05351d..00000000 --- a/owl-bot-staging/v2/src/v2/participants_client.ts +++ /dev/null @@ -1,2784 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/participants_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './participants_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2.Participant|Participants}. - * @class - * @memberof v2 - */ -export class ParticipantsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - participantsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ParticipantsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ParticipantsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listParticipants: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'participants') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2.Participants', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.participantsStub) { - return this.participantsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2.Participants. - this.participantsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.Participants') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2.Participants, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const participantsStubMethods = - ['createParticipant', 'getParticipant', 'listParticipants', 'updateParticipant', 'analyzeContent', 'suggestArticles', 'suggestFaqAnswers']; - for (const methodName of participantsStubMethods) { - const callPromise = this.participantsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.participantsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - createParticipant( - request?: protos.google.cloud.dialogflow.v2.ICreateParticipantRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IParticipant, - protos.google.cloud.dialogflow.v2.ICreateParticipantRequest|undefined, {}|undefined - ]>; - createParticipant( - request: protos.google.cloud.dialogflow.v2.ICreateParticipantRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IParticipant, - protos.google.cloud.dialogflow.v2.ICreateParticipantRequest|null|undefined, - {}|null|undefined>): void; - createParticipant( - request: protos.google.cloud.dialogflow.v2.ICreateParticipantRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IParticipant, - protos.google.cloud.dialogflow.v2.ICreateParticipantRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates a new participant in a conversation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource identifier of the conversation adding the participant. - * Format: `projects//locations//conversations/`. - * @param {google.cloud.dialogflow.v2.Participant} request.participant - * Required. The participant to create. - * @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. - * The first element of the array is an object representing [Participant]{@link google.cloud.dialogflow.v2.Participant}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createParticipant(request); - */ - createParticipant( - request?: protos.google.cloud.dialogflow.v2.ICreateParticipantRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IParticipant, - protos.google.cloud.dialogflow.v2.ICreateParticipantRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IParticipant, - protos.google.cloud.dialogflow.v2.ICreateParticipantRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IParticipant, - protos.google.cloud.dialogflow.v2.ICreateParticipantRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createParticipant(request, options, callback); - } - getParticipant( - request?: protos.google.cloud.dialogflow.v2.IGetParticipantRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IParticipant, - protos.google.cloud.dialogflow.v2.IGetParticipantRequest|undefined, {}|undefined - ]>; - getParticipant( - request: protos.google.cloud.dialogflow.v2.IGetParticipantRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IParticipant, - protos.google.cloud.dialogflow.v2.IGetParticipantRequest|null|undefined, - {}|null|undefined>): void; - getParticipant( - request: protos.google.cloud.dialogflow.v2.IGetParticipantRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IParticipant, - protos.google.cloud.dialogflow.v2.IGetParticipantRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves a conversation participant. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the participant. Format: - * `projects//locations//conversations//participants/`. - * @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. - * The first element of the array is an object representing [Participant]{@link google.cloud.dialogflow.v2.Participant}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getParticipant(request); - */ - getParticipant( - request?: protos.google.cloud.dialogflow.v2.IGetParticipantRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IParticipant, - protos.google.cloud.dialogflow.v2.IGetParticipantRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IParticipant, - protos.google.cloud.dialogflow.v2.IGetParticipantRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IParticipant, - protos.google.cloud.dialogflow.v2.IGetParticipantRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getParticipant(request, options, callback); - } - updateParticipant( - request?: protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IParticipant, - protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest|undefined, {}|undefined - ]>; - updateParticipant( - request: protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IParticipant, - protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest|null|undefined, - {}|null|undefined>): void; - updateParticipant( - request: protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IParticipant, - protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified participant. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2.Participant} request.participant - * Required. The participant to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The mask to specify which fields to update. - * @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. - * The first element of the array is an object representing [Participant]{@link google.cloud.dialogflow.v2.Participant}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateParticipant(request); - */ - updateParticipant( - request?: protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IParticipant, - protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IParticipant, - protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IParticipant, - protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'participant.name': request.participant!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateParticipant(request, options, callback); - } - analyzeContent( - request?: protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse, - protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest|undefined, {}|undefined - ]>; - analyzeContent( - request: protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse, - protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest|null|undefined, - {}|null|undefined>): void; - analyzeContent( - request: protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse, - protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Adds a text (chat, for example), or audio (phone recording, for example) - * message from a participant into the conversation. - * - * Note: Always use agent versions for production traffic - * sent to virtual agents. 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.participant - * Required. The name of the participant this text comes from. - * Format: `projects//locations//conversations//participants/`. - * @param {google.cloud.dialogflow.v2.TextInput} request.textInput - * The natural language text to be processed. - * @param {google.cloud.dialogflow.v2.EventInput} request.eventInput - * An input event to send to Dialogflow. - * @param {google.cloud.dialogflow.v2.OutputAudioConfig} request.replyAudioConfig - * Speech synthesis configuration. - * The speech synthesis settings for a virtual agent that may be configured - * for the associated conversation profile are not used when calling - * AnalyzeContent. If this configuration is not supplied, speech synthesis - * is disabled. - * @param {google.cloud.dialogflow.v2.QueryParameters} request.queryParams - * Parameters for a Dialogflow virtual-agent query. - * @param {string} request.requestId - * A unique identifier for this request. Restricted to 36 ASCII characters. - * A random UUID is recommended. - * This request is only idempotent if a `request_id` is provided. - * @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. - * The first element of the array is an object representing [AnalyzeContentResponse]{@link google.cloud.dialogflow.v2.AnalyzeContentResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.analyzeContent(request); - */ - analyzeContent( - request?: protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse, - protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse, - protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse, - protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'participant': request.participant || '', - }); - this.initialize(); - return this.innerApiCalls.analyzeContent(request, options, callback); - } - suggestArticles( - request?: protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse, - protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest|undefined, {}|undefined - ]>; - suggestArticles( - request: protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse, - protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest|null|undefined, - {}|null|undefined>): void; - suggestArticles( - request: protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse, - protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest|null|undefined, - {}|null|undefined>): void; -/** - * Gets suggested articles for a participant based on specific historical - * messages. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the participant to fetch suggestion for. - * Format: `projects//locations//conversations//participants/`. - * @param {string} request.latestMessage - * The name of the latest conversation message to compile suggestion - * for. If empty, it will be the latest message of the conversation. - * - * Format: `projects//locations//conversations//messages/`. - * @param {number} request.contextSize - * Max number of messages prior to and including - * {@link google.cloud.dialogflow.v2.SuggestArticlesRequest.latest_message|latest_message} to use as context - * when compiling the suggestion. By default 20 and at most 50. - * @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. - * The first element of the array is an object representing [SuggestArticlesResponse]{@link google.cloud.dialogflow.v2.SuggestArticlesResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.suggestArticles(request); - */ - suggestArticles( - request?: protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse, - protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse, - protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse, - protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.suggestArticles(request, options, callback); - } - suggestFaqAnswers( - request?: protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse, - protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest|undefined, {}|undefined - ]>; - suggestFaqAnswers( - request: protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse, - protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest|null|undefined, - {}|null|undefined>): void; - suggestFaqAnswers( - request: protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse, - protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest|null|undefined, - {}|null|undefined>): void; -/** - * Gets suggested faq answers for a participant based on specific historical - * messages. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the participant to fetch suggestion for. - * Format: `projects//locations//conversations//participants/`. - * @param {string} request.latestMessage - * The name of the latest conversation message to compile suggestion - * for. If empty, it will be the latest message of the conversation. - * - * Format: `projects//locations//conversations//messages/`. - * @param {number} request.contextSize - * Max number of messages prior to and including - * [latest_message] to use as context when compiling the - * suggestion. By default 20 and at most 50. - * @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. - * The first element of the array is an object representing [SuggestFaqAnswersResponse]{@link google.cloud.dialogflow.v2.SuggestFaqAnswersResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.suggestFaqAnswers(request); - */ - suggestFaqAnswers( - request?: protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse, - protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse, - protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse, - protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.suggestFaqAnswers(request, options, callback); - } - - listParticipants( - request?: protos.google.cloud.dialogflow.v2.IListParticipantsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IParticipant[], - protos.google.cloud.dialogflow.v2.IListParticipantsRequest|null, - protos.google.cloud.dialogflow.v2.IListParticipantsResponse - ]>; - listParticipants( - request: protos.google.cloud.dialogflow.v2.IListParticipantsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListParticipantsRequest, - protos.google.cloud.dialogflow.v2.IListParticipantsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IParticipant>): void; - listParticipants( - request: protos.google.cloud.dialogflow.v2.IListParticipantsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListParticipantsRequest, - protos.google.cloud.dialogflow.v2.IListParticipantsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IParticipant>): void; -/** - * Returns the list of all participants in the specified conversation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The conversation to list all participants from. - * Format: `projects//locations//conversations/`. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [Participant]{@link google.cloud.dialogflow.v2.Participant}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listParticipantsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listParticipants( - request?: protos.google.cloud.dialogflow.v2.IListParticipantsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2.IListParticipantsRequest, - protos.google.cloud.dialogflow.v2.IListParticipantsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IParticipant>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListParticipantsRequest, - protos.google.cloud.dialogflow.v2.IListParticipantsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IParticipant>): - Promise<[ - protos.google.cloud.dialogflow.v2.IParticipant[], - protos.google.cloud.dialogflow.v2.IListParticipantsRequest|null, - protos.google.cloud.dialogflow.v2.IListParticipantsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listParticipants(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The conversation to list all participants from. - * Format: `projects//locations//conversations/`. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Participant]{@link google.cloud.dialogflow.v2.Participant} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listParticipantsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listParticipantsStream( - request?: protos.google.cloud.dialogflow.v2.IListParticipantsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listParticipants.createStream( - this.innerApiCalls.listParticipants as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listParticipants`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The conversation to list all participants from. - * Format: `projects//locations//conversations/`. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Participant]{@link google.cloud.dialogflow.v2.Participant}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listParticipantsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listParticipantsAsync( - request?: protos.google.cloud.dialogflow.v2.IListParticipantsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listParticipants.asyncIterate( - this.innerApiCalls['listParticipants'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.participantsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/participants_client_config.json b/owl-bot-staging/v2/src/v2/participants_client_config.json deleted file mode 100644 index 5a688201..00000000 --- a/owl-bot-staging/v2/src/v2/participants_client_config.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2.Participants": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateParticipant": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetParticipant": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ListParticipants": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateParticipant": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "AnalyzeContent": { - "timeout_millis": 220000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "SuggestArticles": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "SuggestFaqAnswers": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/participants_proto_list.json b/owl-bot-staging/v2/src/v2/participants_proto_list.json deleted file mode 100644 index d2ecb25e..00000000 --- a/owl-bot-staging/v2/src/v2/participants_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2/agent.proto", - "../../protos/google/cloud/dialogflow/v2/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2/context.proto", - "../../protos/google/cloud/dialogflow/v2/conversation.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2/document.proto", - "../../protos/google/cloud/dialogflow/v2/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/environment.proto", - "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2/gcs.proto", - "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2/intent.proto", - "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2/participant.proto", - "../../protos/google/cloud/dialogflow/v2/session.proto", - "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2/version.proto", - "../../protos/google/cloud/dialogflow/v2/webhook.proto" -] diff --git a/owl-bot-staging/v2/src/v2/session_entity_types_client.ts b/owl-bot-staging/v2/src/v2/session_entity_types_client.ts deleted file mode 100644 index ea94243f..00000000 --- a/owl-bot-staging/v2/src/v2/session_entity_types_client.ts +++ /dev/null @@ -1,2677 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/session_entity_types_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './session_entity_types_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2.SessionEntityType|SessionEntityTypes}. - * @class - * @memberof v2 - */ -export class SessionEntityTypesClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - sessionEntityTypesStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SessionEntityTypesClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SessionEntityTypesClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listSessionEntityTypes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sessionEntityTypes') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2.SessionEntityTypes', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sessionEntityTypesStub) { - return this.sessionEntityTypesStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2.SessionEntityTypes. - this.sessionEntityTypesStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.SessionEntityTypes') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2.SessionEntityTypes, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sessionEntityTypesStubMethods = - ['listSessionEntityTypes', 'getSessionEntityType', 'createSessionEntityType', 'updateSessionEntityType', 'deleteSessionEntityType']; - for (const methodName of sessionEntityTypesStubMethods) { - const callPromise = this.sessionEntityTypesStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sessionEntityTypesStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getSessionEntityType( - request?: protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.ISessionEntityType, - protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest|undefined, {}|undefined - ]>; - getSessionEntityType( - request: protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.ISessionEntityType, - protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): void; - getSessionEntityType( - request: protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.ISessionEntityType, - protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specified session entity type. - * - * This method doesn't work with Google Assistant integration. - * Contact Dialogflow support if you need to use session entities - * with Google Assistant integration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the session entity type. Format: - * `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. - * If `Environment ID` is not specified, we assume default 'draft' - * environment. If `User ID` is not specified, we assume default '-' user. - * @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. - * The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getSessionEntityType(request); - */ - getSessionEntityType( - request?: protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.ISessionEntityType, - protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.ISessionEntityType, - protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.ISessionEntityType, - protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getSessionEntityType(request, options, callback); - } - createSessionEntityType( - request?: protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.ISessionEntityType, - protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest|undefined, {}|undefined - ]>; - createSessionEntityType( - request: protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.ISessionEntityType, - protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): void; - createSessionEntityType( - request: protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.ISessionEntityType, - protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates a session entity type. - * - * If the specified session entity type already exists, overrides the session - * entity type. - * - * This method doesn't work with Google Assistant integration. - * Contact Dialogflow support if you need to use session entities - * with Google Assistant integration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The session to create a session entity type for. - * Format: `projects//agent/sessions/` or - * `projects//agent/environments//users// - * sessions/`. - * If `Environment ID` is not specified, we assume default 'draft' - * environment. If `User ID` is not specified, we assume default '-' user. - * @param {google.cloud.dialogflow.v2.SessionEntityType} request.sessionEntityType - * Required. The session entity type to create. - * @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. - * The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createSessionEntityType(request); - */ - createSessionEntityType( - request?: protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.ISessionEntityType, - protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.ISessionEntityType, - protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.ISessionEntityType, - protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createSessionEntityType(request, options, callback); - } - updateSessionEntityType( - request?: protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.ISessionEntityType, - protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest|undefined, {}|undefined - ]>; - updateSessionEntityType( - request: protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.ISessionEntityType, - protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): void; - updateSessionEntityType( - request: protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.ISessionEntityType, - protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified session entity type. - * - * This method doesn't work with Google Assistant integration. - * Contact Dialogflow support if you need to use session entities - * with Google Assistant integration. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2.SessionEntityType} request.sessionEntityType - * Required. The session entity type to update. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The mask to control which fields get updated. - * @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. - * The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateSessionEntityType(request); - */ - updateSessionEntityType( - request?: protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.ISessionEntityType, - protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.ISessionEntityType, - protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.ISessionEntityType, - protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'session_entity_type.name': request.sessionEntityType!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateSessionEntityType(request, options, callback); - } - deleteSessionEntityType( - request?: protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest|undefined, {}|undefined - ]>; - deleteSessionEntityType( - request: protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): void; - deleteSessionEntityType( - request: protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deletes the specified session entity type. - * - * This method doesn't work with Google Assistant integration. - * Contact Dialogflow support if you need to use session entities - * with Google Assistant integration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the entity type to delete. Format: - * `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. - * If `Environment ID` is not specified, we assume default 'draft' - * environment. If `User ID` is not specified, we assume default '-' user. - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteSessionEntityType(request); - */ - deleteSessionEntityType( - request?: protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteSessionEntityType(request, options, callback); - } - - listSessionEntityTypes( - request?: protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.ISessionEntityType[], - protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest|null, - protos.google.cloud.dialogflow.v2.IListSessionEntityTypesResponse - ]>; - listSessionEntityTypes( - request: protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, - protos.google.cloud.dialogflow.v2.IListSessionEntityTypesResponse|null|undefined, - protos.google.cloud.dialogflow.v2.ISessionEntityType>): void; - listSessionEntityTypes( - request: protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, - protos.google.cloud.dialogflow.v2.IListSessionEntityTypesResponse|null|undefined, - protos.google.cloud.dialogflow.v2.ISessionEntityType>): void; -/** - * Returns the list of all session entity types in the specified session. - * - * This method doesn't work with Google Assistant integration. - * Contact Dialogflow support if you need to use session entities - * with Google Assistant integration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The session to list all session entity types from. - * Format: `projects//agent/sessions/` or - * `projects//agent/environments//users// - * sessions/`. - * If `Environment ID` is not specified, we assume default 'draft' - * environment. If `User ID` is not specified, we assume default '-' user. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSessionEntityTypesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listSessionEntityTypes( - request?: protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, - protos.google.cloud.dialogflow.v2.IListSessionEntityTypesResponse|null|undefined, - protos.google.cloud.dialogflow.v2.ISessionEntityType>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, - protos.google.cloud.dialogflow.v2.IListSessionEntityTypesResponse|null|undefined, - protos.google.cloud.dialogflow.v2.ISessionEntityType>): - Promise<[ - protos.google.cloud.dialogflow.v2.ISessionEntityType[], - protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest|null, - protos.google.cloud.dialogflow.v2.IListSessionEntityTypesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listSessionEntityTypes(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The session to list all session entity types from. - * Format: `projects//agent/sessions/` or - * `projects//agent/environments//users// - * sessions/`. - * If `Environment ID` is not specified, we assume default 'draft' - * environment. If `User ID` is not specified, we assume default '-' user. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSessionEntityTypesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listSessionEntityTypesStream( - request?: protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listSessionEntityTypes.createStream( - this.innerApiCalls.listSessionEntityTypes as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSessionEntityTypes`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The session to list all session entity types from. - * Format: `projects//agent/sessions/` or - * `projects//agent/environments//users// - * sessions/`. - * If `Environment ID` is not specified, we assume default 'draft' - * environment. If `User ID` is not specified, we assume default '-' user. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listSessionEntityTypesAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listSessionEntityTypesAsync( - request?: protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listSessionEntityTypes.asyncIterate( - this.innerApiCalls['listSessionEntityTypes'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSession resource name string. - * - * @param {string} project - * @param {string} session - * @returns {string} Resource name string. - */ - projectAgentSessionPath(project:string,session:string) { - return this.pathTemplates.projectAgentSessionPathTemplate.render({ - project: project, - session: session, - }); - } - - /** - * Parse the project from ProjectAgentSession resource. - * - * @param {string} projectAgentSessionName - * A fully-qualified path representing project_agent_session resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionName(projectAgentSessionName: string) { - return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).project; - } - - /** - * Parse the session from ProjectAgentSession resource. - * - * @param {string} projectAgentSessionName - * A fully-qualified path representing project_agent_session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionName(projectAgentSessionName: string) { - return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).session; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.sessionEntityTypesStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/session_entity_types_client_config.json b/owl-bot-staging/v2/src/v2/session_entity_types_client_config.json deleted file mode 100644 index 52a412a1..00000000 --- a/owl-bot-staging/v2/src/v2/session_entity_types_client_config.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2.SessionEntityTypes": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListSessionEntityTypes": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetSessionEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateSessionEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateSessionEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteSessionEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/session_entity_types_proto_list.json b/owl-bot-staging/v2/src/v2/session_entity_types_proto_list.json deleted file mode 100644 index d2ecb25e..00000000 --- a/owl-bot-staging/v2/src/v2/session_entity_types_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2/agent.proto", - "../../protos/google/cloud/dialogflow/v2/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2/context.proto", - "../../protos/google/cloud/dialogflow/v2/conversation.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2/document.proto", - "../../protos/google/cloud/dialogflow/v2/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/environment.proto", - "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2/gcs.proto", - "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2/intent.proto", - "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2/participant.proto", - "../../protos/google/cloud/dialogflow/v2/session.proto", - "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2/version.proto", - "../../protos/google/cloud/dialogflow/v2/webhook.proto" -] diff --git a/owl-bot-staging/v2/src/v2/sessions_client.ts b/owl-bot-staging/v2/src/v2/sessions_client.ts deleted file mode 100644 index b27b0d9d..00000000 --- a/owl-bot-staging/v2/src/v2/sessions_client.ts +++ /dev/null @@ -1,2476 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/sessions_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sessions_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * A service used for session interactions. - * - * For more information, see the [API interactions - * guide](https://cloud.google.com/dialogflow/docs/api-overview). - * @class - * @memberof v2 - */ -export class SessionsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - sessionsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SessionsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SessionsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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. - // Provide descriptors for these. - this.descriptors.stream = { - streamingDetectIntent: new this._gaxModule.StreamDescriptor(gax.StreamType.BIDI_STREAMING) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2.Sessions', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sessionsStub) { - return this.sessionsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2.Sessions. - this.sessionsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.Sessions') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2.Sessions, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sessionsStubMethods = - ['detectIntent', 'streamingDetectIntent']; - for (const methodName of sessionsStubMethods) { - const callPromise = this.sessionsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.stream[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sessionsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - detectIntent( - request?: protos.google.cloud.dialogflow.v2.IDetectIntentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IDetectIntentResponse, - protos.google.cloud.dialogflow.v2.IDetectIntentRequest|undefined, {}|undefined - ]>; - detectIntent( - request: protos.google.cloud.dialogflow.v2.IDetectIntentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IDetectIntentResponse, - protos.google.cloud.dialogflow.v2.IDetectIntentRequest|null|undefined, - {}|null|undefined>): void; - detectIntent( - request: protos.google.cloud.dialogflow.v2.IDetectIntentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IDetectIntentResponse, - protos.google.cloud.dialogflow.v2.IDetectIntentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Processes a natural language query and returns structured, actionable data - * as a result. This method is not idempotent, because it may cause contexts - * and session entity types to be updated, which in turn might affect - * results of future queries. - * - * 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 - * Required. The name of the session this query is sent to. Format: - * `projects//agent/sessions/`, or - * `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - * default 'draft' environment (`Environment ID` might be referred to as - * environment name at some places). If `User ID` is not specified, we are - * using "-". It's up to the API caller to choose an appropriate `Session ID` - * and `User Id`. They can be a random number or some type of user and session - * identifiers (preferably hashed). 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.v2.QueryParameters} request.queryParams - * The parameters of this query. - * @param {google.cloud.dialogflow.v2.QueryInput} request.queryInput - * Required. The input specification. It can be set to: - * - * 1. an audio config - * which instructs the speech recognizer how to process the speech audio, - * - * 2. a conversational query in the form of text, or - * - * 3. an event that specifies which intent to trigger. - * @param {google.cloud.dialogflow.v2.OutputAudioConfig} request.outputAudioConfig - * Instructs the speech synthesizer how to generate the output - * audio. If this field is not set and agent-level speech synthesizer is not - * configured, no output audio is generated. - * @param {google.protobuf.FieldMask} request.outputAudioConfigMask - * Mask for {@link google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config|output_audio_config} indicating which settings in this - * request-level config should override speech synthesizer settings defined at - * agent-level. - * - * If unspecified or empty, {@link google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config|output_audio_config} replaces the agent-level - * config in its entirety. - * @param {Buffer} request.inputAudio - * The natural language speech audio to be processed. This field - * should be populated iff `query_input` is set to an input audio config. - * A single request can contain up to 1 minute of speech audio data. - * @param {object} [options] - * 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. - * The first element of the array is an object representing [DetectIntentResponse]{@link google.cloud.dialogflow.v2.DetectIntentResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.detectIntent(request); - */ - detectIntent( - request?: protos.google.cloud.dialogflow.v2.IDetectIntentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IDetectIntentResponse, - protos.google.cloud.dialogflow.v2.IDetectIntentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IDetectIntentResponse, - protos.google.cloud.dialogflow.v2.IDetectIntentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IDetectIntentResponse, - protos.google.cloud.dialogflow.v2.IDetectIntentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'session': request.session || '', - }); - this.initialize(); - return this.innerApiCalls.detectIntent(request, options, callback); - } - -/** - * Processes a natural language query in audio format in a streaming fashion - * and returns structured, actionable data as a result. This method is only - * available via the gRPC API (not REST). - * - * 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} - * An object stream which is both readable and writable. It accepts objects - * representing [StreamingDetectIntentRequest]{@link google.cloud.dialogflow.v2.StreamingDetectIntentRequest} for write() method, and - * will emit objects representing [StreamingDetectIntentResponse]{@link google.cloud.dialogflow.v2.StreamingDetectIntentResponse} on 'data' event asynchronously. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming) - * for more details and examples. - * @example - * const stream = client.streamingDetectIntent(); - * stream.on('data', (response) => { ... }); - * stream.on('end', () => { ... }); - * stream.write(request); - * stream.end(); - */ - streamingDetectIntent( - options?: CallOptions): - gax.CancellableStream { - this.initialize(); - return this.innerApiCalls.streamingDetectIntent(options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSession resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionPath(project:string,environment:string,user:string,session:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSession resource. - * - * @param {string} projectAgentEnvironmentUserSessionName - * A fully-qualified path representing project_agent_environment_user_session resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionName(projectAgentEnvironmentUserSessionName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match(projectAgentEnvironmentUserSessionName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSession resource. - * - * @param {string} projectAgentEnvironmentUserSessionName - * A fully-qualified path representing project_agent_environment_user_session resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionName(projectAgentEnvironmentUserSessionName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match(projectAgentEnvironmentUserSessionName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSession resource. - * - * @param {string} projectAgentEnvironmentUserSessionName - * A fully-qualified path representing project_agent_environment_user_session resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionName(projectAgentEnvironmentUserSessionName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match(projectAgentEnvironmentUserSessionName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSession resource. - * - * @param {string} projectAgentEnvironmentUserSessionName - * A fully-qualified path representing project_agent_environment_user_session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionName(projectAgentEnvironmentUserSessionName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match(projectAgentEnvironmentUserSessionName).session; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSession resource name string. - * - * @param {string} project - * @param {string} session - * @returns {string} Resource name string. - */ - projectAgentSessionPath(project:string,session:string) { - return this.pathTemplates.projectAgentSessionPathTemplate.render({ - project: project, - session: session, - }); - } - - /** - * Parse the project from ProjectAgentSession resource. - * - * @param {string} projectAgentSessionName - * A fully-qualified path representing project_agent_session resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionName(projectAgentSessionName: string) { - return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).project; - } - - /** - * Parse the session from ProjectAgentSession resource. - * - * @param {string} projectAgentSessionName - * A fully-qualified path representing project_agent_session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionName(projectAgentSessionName: string) { - return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).session; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSession resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionPath(project:string,location:string,environment:string,user:string,session:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSession resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionName - * A fully-qualified path representing project_location_agent_environment_user_session resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionName(projectLocationAgentEnvironmentUserSessionName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match(projectLocationAgentEnvironmentUserSessionName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSession resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionName - * A fully-qualified path representing project_location_agent_environment_user_session resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionName(projectLocationAgentEnvironmentUserSessionName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match(projectLocationAgentEnvironmentUserSessionName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSession resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionName - * A fully-qualified path representing project_location_agent_environment_user_session resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionName(projectLocationAgentEnvironmentUserSessionName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match(projectLocationAgentEnvironmentUserSessionName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSession resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionName - * A fully-qualified path representing project_location_agent_environment_user_session resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionName(projectLocationAgentEnvironmentUserSessionName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match(projectLocationAgentEnvironmentUserSessionName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSession resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionName - * A fully-qualified path representing project_location_agent_environment_user_session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionName(projectLocationAgentEnvironmentUserSessionName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match(projectLocationAgentEnvironmentUserSessionName).session; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSession resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @returns {string} Resource name string. - */ - projectLocationAgentSessionPath(project:string,location:string,session:string) { - return this.pathTemplates.projectLocationAgentSessionPathTemplate.render({ - project: project, - location: location, - session: session, - }); - } - - /** - * Parse the project from ProjectLocationAgentSession resource. - * - * @param {string} projectLocationAgentSessionName - * A fully-qualified path representing project_location_agent_session resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionName(projectLocationAgentSessionName: string) { - return this.pathTemplates.projectLocationAgentSessionPathTemplate.match(projectLocationAgentSessionName).project; - } - - /** - * Parse the location from ProjectLocationAgentSession resource. - * - * @param {string} projectLocationAgentSessionName - * A fully-qualified path representing project_location_agent_session resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionName(projectLocationAgentSessionName: string) { - return this.pathTemplates.projectLocationAgentSessionPathTemplate.match(projectLocationAgentSessionName).location; - } - - /** - * Parse the session from ProjectLocationAgentSession resource. - * - * @param {string} projectLocationAgentSessionName - * A fully-qualified path representing project_location_agent_session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionName(projectLocationAgentSessionName: string) { - return this.pathTemplates.projectLocationAgentSessionPathTemplate.match(projectLocationAgentSessionName).session; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.sessionsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/sessions_client_config.json b/owl-bot-staging/v2/src/v2/sessions_client_config.json deleted file mode 100644 index b9c1b92d..00000000 --- a/owl-bot-staging/v2/src/v2/sessions_client_config.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2.Sessions": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "DetectIntent": { - "timeout_millis": 220000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "StreamingDetectIntent": { - "timeout_millis": 220000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/sessions_proto_list.json b/owl-bot-staging/v2/src/v2/sessions_proto_list.json deleted file mode 100644 index d2ecb25e..00000000 --- a/owl-bot-staging/v2/src/v2/sessions_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2/agent.proto", - "../../protos/google/cloud/dialogflow/v2/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2/context.proto", - "../../protos/google/cloud/dialogflow/v2/conversation.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2/document.proto", - "../../protos/google/cloud/dialogflow/v2/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/environment.proto", - "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2/gcs.proto", - "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2/intent.proto", - "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2/participant.proto", - "../../protos/google/cloud/dialogflow/v2/session.proto", - "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2/version.proto", - "../../protos/google/cloud/dialogflow/v2/webhook.proto" -] diff --git a/owl-bot-staging/v2/src/v2/versions_client.ts b/owl-bot-staging/v2/src/v2/versions_client.ts deleted file mode 100644 index 7a2459e2..00000000 --- a/owl-bot-staging/v2/src/v2/versions_client.ts +++ /dev/null @@ -1,2620 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/versions_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './versions_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2.Version|Versions}. - * @class - * @memberof v2 - */ -export class VersionsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - versionsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of VersionsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof VersionsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listVersions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'versions') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2.Versions', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.versionsStub) { - return this.versionsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2.Versions. - this.versionsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.Versions') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2.Versions, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const versionsStubMethods = - ['listVersions', 'getVersion', 'createVersion', 'updateVersion', 'deleteVersion']; - for (const methodName of versionsStubMethods) { - const callPromise = this.versionsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.versionsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getVersion( - request?: protos.google.cloud.dialogflow.v2.IGetVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IVersion, - protos.google.cloud.dialogflow.v2.IGetVersionRequest|undefined, {}|undefined - ]>; - getVersion( - request: protos.google.cloud.dialogflow.v2.IGetVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IVersion, - protos.google.cloud.dialogflow.v2.IGetVersionRequest|null|undefined, - {}|null|undefined>): void; - getVersion( - request: protos.google.cloud.dialogflow.v2.IGetVersionRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IVersion, - protos.google.cloud.dialogflow.v2.IGetVersionRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specified agent version. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the version. - * Supported formats: - * - * - `projects//agent/versions/` - * - `projects//locations//agent/versions/` - * @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. - * The first element of the array is an object representing [Version]{@link google.cloud.dialogflow.v2.Version}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getVersion(request); - */ - getVersion( - request?: protos.google.cloud.dialogflow.v2.IGetVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IVersion, - protos.google.cloud.dialogflow.v2.IGetVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IVersion, - protos.google.cloud.dialogflow.v2.IGetVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IVersion, - protos.google.cloud.dialogflow.v2.IGetVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getVersion(request, options, callback); - } - createVersion( - request?: protos.google.cloud.dialogflow.v2.ICreateVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IVersion, - protos.google.cloud.dialogflow.v2.ICreateVersionRequest|undefined, {}|undefined - ]>; - createVersion( - request: protos.google.cloud.dialogflow.v2.ICreateVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IVersion, - protos.google.cloud.dialogflow.v2.ICreateVersionRequest|null|undefined, - {}|null|undefined>): void; - createVersion( - request: protos.google.cloud.dialogflow.v2.ICreateVersionRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IVersion, - protos.google.cloud.dialogflow.v2.ICreateVersionRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates an agent version. - * - * The new version points to the agent instance in the "default" environment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to create a version for. - * Supported formats: - * - * - `projects//agent` - * - `projects//locations//agent` - * @param {google.cloud.dialogflow.v2.Version} request.version - * Required. The version to create. - * @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. - * The first element of the array is an object representing [Version]{@link google.cloud.dialogflow.v2.Version}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createVersion(request); - */ - createVersion( - request?: protos.google.cloud.dialogflow.v2.ICreateVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IVersion, - protos.google.cloud.dialogflow.v2.ICreateVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IVersion, - protos.google.cloud.dialogflow.v2.ICreateVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IVersion, - protos.google.cloud.dialogflow.v2.ICreateVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createVersion(request, options, callback); - } - updateVersion( - request?: protos.google.cloud.dialogflow.v2.IUpdateVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IVersion, - protos.google.cloud.dialogflow.v2.IUpdateVersionRequest|undefined, {}|undefined - ]>; - updateVersion( - request: protos.google.cloud.dialogflow.v2.IUpdateVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IVersion, - protos.google.cloud.dialogflow.v2.IUpdateVersionRequest|null|undefined, - {}|null|undefined>): void; - updateVersion( - request: protos.google.cloud.dialogflow.v2.IUpdateVersionRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IVersion, - protos.google.cloud.dialogflow.v2.IUpdateVersionRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified agent version. - * - * Note that this method does not allow you to update the state of the agent - * the given version points to. It allows you to update only mutable - * properties of the version resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2.Version} request.version - * Required. The version to update. - * Supported formats: - * - * - `projects//agent/versions/` - * - `projects//locations//agent/versions/` - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The mask to control which fields get updated. - * @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. - * The first element of the array is an object representing [Version]{@link google.cloud.dialogflow.v2.Version}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateVersion(request); - */ - updateVersion( - request?: protos.google.cloud.dialogflow.v2.IUpdateVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IVersion, - protos.google.cloud.dialogflow.v2.IUpdateVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IVersion, - protos.google.cloud.dialogflow.v2.IUpdateVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IVersion, - protos.google.cloud.dialogflow.v2.IUpdateVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'version.name': request.version!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateVersion(request, options, callback); - } - deleteVersion( - request?: protos.google.cloud.dialogflow.v2.IDeleteVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteVersionRequest|undefined, {}|undefined - ]>; - deleteVersion( - request: protos.google.cloud.dialogflow.v2.IDeleteVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteVersionRequest|null|undefined, - {}|null|undefined>): void; - deleteVersion( - request: protos.google.cloud.dialogflow.v2.IDeleteVersionRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteVersionRequest|null|undefined, - {}|null|undefined>): void; -/** - * Delete the specified agent version. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the version to delete. - * Supported formats: - * - * - `projects//agent/versions/` - * - `projects//locations//agent/versions/` - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteVersion(request); - */ - deleteVersion( - request?: protos.google.cloud.dialogflow.v2.IDeleteVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2.IDeleteVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteVersion(request, options, callback); - } - - listVersions( - request?: protos.google.cloud.dialogflow.v2.IListVersionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IVersion[], - protos.google.cloud.dialogflow.v2.IListVersionsRequest|null, - protos.google.cloud.dialogflow.v2.IListVersionsResponse - ]>; - listVersions( - request: protos.google.cloud.dialogflow.v2.IListVersionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListVersionsRequest, - protos.google.cloud.dialogflow.v2.IListVersionsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IVersion>): void; - listVersions( - request: protos.google.cloud.dialogflow.v2.IListVersionsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListVersionsRequest, - protos.google.cloud.dialogflow.v2.IListVersionsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IVersion>): void; -/** - * Returns the list of all versions of the specified agent. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all versions from. - * Supported formats: - * - * - `projects//agent` - * - `projects//locations//agent` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [Version]{@link google.cloud.dialogflow.v2.Version}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listVersionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listVersions( - request?: protos.google.cloud.dialogflow.v2.IListVersionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2.IListVersionsRequest, - protos.google.cloud.dialogflow.v2.IListVersionsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IVersion>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListVersionsRequest, - protos.google.cloud.dialogflow.v2.IListVersionsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IVersion>): - Promise<[ - protos.google.cloud.dialogflow.v2.IVersion[], - protos.google.cloud.dialogflow.v2.IListVersionsRequest|null, - protos.google.cloud.dialogflow.v2.IListVersionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listVersions(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all versions from. - * Supported formats: - * - * - `projects//agent` - * - `projects//locations//agent` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Version]{@link google.cloud.dialogflow.v2.Version} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listVersionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listVersionsStream( - request?: protos.google.cloud.dialogflow.v2.IListVersionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listVersions.createStream( - this.innerApiCalls.listVersions as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listVersions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all versions from. - * Supported formats: - * - * - `projects//agent` - * - `projects//locations//agent` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Version]{@link google.cloud.dialogflow.v2.Version}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listVersionsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listVersionsAsync( - request?: protos.google.cloud.dialogflow.v2.IListVersionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listVersions.asyncIterate( - this.innerApiCalls['listVersions'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.versionsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/versions_client_config.json b/owl-bot-staging/v2/src/v2/versions_client_config.json deleted file mode 100644 index db17e434..00000000 --- a/owl-bot-staging/v2/src/v2/versions_client_config.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2.Versions": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListVersions": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetVersion": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateVersion": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateVersion": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteVersion": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/versions_proto_list.json b/owl-bot-staging/v2/src/v2/versions_proto_list.json deleted file mode 100644 index d2ecb25e..00000000 --- a/owl-bot-staging/v2/src/v2/versions_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2/agent.proto", - "../../protos/google/cloud/dialogflow/v2/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2/context.proto", - "../../protos/google/cloud/dialogflow/v2/conversation.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2/document.proto", - "../../protos/google/cloud/dialogflow/v2/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/environment.proto", - "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2/gcs.proto", - "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2/intent.proto", - "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2/participant.proto", - "../../protos/google/cloud/dialogflow/v2/session.proto", - "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2/version.proto", - "../../protos/google/cloud/dialogflow/v2/webhook.proto" -] diff --git a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 85cdb2d0..00000000 --- a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const dialogflow = require('@google-cloud/dialogflow'); - -function main() { - const agentsClient = new dialogflow.AgentsClient(); - const answerRecordsClient = new dialogflow.AnswerRecordsClient(); - const contextsClient = new dialogflow.ContextsClient(); - const conversationProfilesClient = new dialogflow.ConversationProfilesClient(); - const conversationsClient = new dialogflow.ConversationsClient(); - const documentsClient = new dialogflow.DocumentsClient(); - const entityTypesClient = new dialogflow.EntityTypesClient(); - const environmentsClient = new dialogflow.EnvironmentsClient(); - const fulfillmentsClient = new dialogflow.FulfillmentsClient(); - const intentsClient = new dialogflow.IntentsClient(); - const knowledgeBasesClient = new dialogflow.KnowledgeBasesClient(); - const participantsClient = new dialogflow.ParticipantsClient(); - const sessionEntityTypesClient = new dialogflow.SessionEntityTypesClient(); - const sessionsClient = new dialogflow.SessionsClient(); - const versionsClient = new dialogflow.VersionsClient(); -} - -main(); diff --git a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 5a454ee2..00000000 --- a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {AgentsClient, AnswerRecordsClient, ContextsClient, ConversationProfilesClient, ConversationsClient, DocumentsClient, EntityTypesClient, EnvironmentsClient, FulfillmentsClient, IntentsClient, KnowledgeBasesClient, ParticipantsClient, SessionEntityTypesClient, SessionsClient, VersionsClient} from '@google-cloud/dialogflow'; - -// check that the client class type name can be used -function doStuffWithAgentsClient(client: AgentsClient) { - client.close(); -} -function doStuffWithAnswerRecordsClient(client: AnswerRecordsClient) { - client.close(); -} -function doStuffWithContextsClient(client: ContextsClient) { - client.close(); -} -function doStuffWithConversationProfilesClient(client: ConversationProfilesClient) { - client.close(); -} -function doStuffWithConversationsClient(client: ConversationsClient) { - client.close(); -} -function doStuffWithDocumentsClient(client: DocumentsClient) { - client.close(); -} -function doStuffWithEntityTypesClient(client: EntityTypesClient) { - client.close(); -} -function doStuffWithEnvironmentsClient(client: EnvironmentsClient) { - client.close(); -} -function doStuffWithFulfillmentsClient(client: FulfillmentsClient) { - client.close(); -} -function doStuffWithIntentsClient(client: IntentsClient) { - client.close(); -} -function doStuffWithKnowledgeBasesClient(client: KnowledgeBasesClient) { - client.close(); -} -function doStuffWithParticipantsClient(client: ParticipantsClient) { - client.close(); -} -function doStuffWithSessionEntityTypesClient(client: SessionEntityTypesClient) { - client.close(); -} -function doStuffWithSessionsClient(client: SessionsClient) { - client.close(); -} -function doStuffWithVersionsClient(client: VersionsClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const agentsClient = new AgentsClient(); - doStuffWithAgentsClient(agentsClient); - // check that the client instance can be created - const answerRecordsClient = new AnswerRecordsClient(); - doStuffWithAnswerRecordsClient(answerRecordsClient); - // check that the client instance can be created - const contextsClient = new ContextsClient(); - doStuffWithContextsClient(contextsClient); - // check that the client instance can be created - const conversationProfilesClient = new ConversationProfilesClient(); - doStuffWithConversationProfilesClient(conversationProfilesClient); - // check that the client instance can be created - const conversationsClient = new ConversationsClient(); - doStuffWithConversationsClient(conversationsClient); - // check that the client instance can be created - const documentsClient = new DocumentsClient(); - doStuffWithDocumentsClient(documentsClient); - // check that the client instance can be created - const entityTypesClient = new EntityTypesClient(); - doStuffWithEntityTypesClient(entityTypesClient); - // check that the client instance can be created - const environmentsClient = new EnvironmentsClient(); - doStuffWithEnvironmentsClient(environmentsClient); - // check that the client instance can be created - const fulfillmentsClient = new FulfillmentsClient(); - doStuffWithFulfillmentsClient(fulfillmentsClient); - // check that the client instance can be created - const intentsClient = new IntentsClient(); - doStuffWithIntentsClient(intentsClient); - // check that the client instance can be created - const knowledgeBasesClient = new KnowledgeBasesClient(); - doStuffWithKnowledgeBasesClient(knowledgeBasesClient); - // check that the client instance can be created - const participantsClient = new ParticipantsClient(); - doStuffWithParticipantsClient(participantsClient); - // check that the client instance can be created - const sessionEntityTypesClient = new SessionEntityTypesClient(); - doStuffWithSessionEntityTypesClient(sessionEntityTypesClient); - // check that the client instance can be created - const sessionsClient = new SessionsClient(); - doStuffWithSessionsClient(sessionsClient); - // check that the client instance can be created - const versionsClient = new VersionsClient(); - doStuffWithVersionsClient(versionsClient); -} - -main(); diff --git a/owl-bot-staging/v2/system-test/install.ts b/owl-bot-staging/v2/system-test/install.ts deleted file mode 100644 index 1f850b52..00000000 --- a/owl-bot-staging/v2/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v2/test/gapic_agents_v2.ts b/owl-bot-staging/v2/test/gapic_agents_v2.ts deleted file mode 100644 index de3be84d..00000000 --- a/owl-bot-staging/v2/test/gapic_agents_v2.ts +++ /dev/null @@ -1,2926 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as agentsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.AgentsClient', () => { - it('has servicePath', () => { - const servicePath = agentsModule.v2.AgentsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = agentsModule.v2.AgentsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = agentsModule.v2.AgentsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new agentsModule.v2.AgentsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new agentsModule.v2.AgentsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.agentsStub, undefined); - await client.initialize(); - assert(client.agentsStub); - }); - - it('has close method', () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getAgent', () => { - it('invokes getAgent without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()); - client.innerApiCalls.getAgent = stubSimpleCall(expectedResponse); - const [response] = await client.getAgent(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getAgent without error using callback', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()); - client.innerApiCalls.getAgent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAgent( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IAgent|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getAgent with error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getAgent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAgent(request), expectedError); - assert((client.innerApiCalls.getAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('setAgent', () => { - it('invokes setAgent without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SetAgentRequest()); - request.agent = {}; - request.agent.parent = ''; - const expectedHeaderRequestParams = "agent.parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()); - client.innerApiCalls.setAgent = stubSimpleCall(expectedResponse); - const [response] = await client.setAgent(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes setAgent without error using callback', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SetAgentRequest()); - request.agent = {}; - request.agent.parent = ''; - const expectedHeaderRequestParams = "agent.parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()); - client.innerApiCalls.setAgent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setAgent( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IAgent|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes setAgent with error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SetAgentRequest()); - request.agent = {}; - request.agent.parent = ''; - const expectedHeaderRequestParams = "agent.parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.setAgent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setAgent(request), expectedError); - assert((client.innerApiCalls.setAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteAgent', () => { - it('invokes deleteAgent without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteAgent = stubSimpleCall(expectedResponse); - const [response] = await client.deleteAgent(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteAgent without error using callback', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteAgent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAgent( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteAgent with error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAgent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteAgent(request), expectedError); - assert((client.innerApiCalls.deleteAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getValidationResult', () => { - it('invokes getValidationResult without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetValidationResultRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ValidationResult()); - client.innerApiCalls.getValidationResult = stubSimpleCall(expectedResponse); - const [response] = await client.getValidationResult(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getValidationResult as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getValidationResult without error using callback', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetValidationResultRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ValidationResult()); - client.innerApiCalls.getValidationResult = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getValidationResult( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IValidationResult|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getValidationResult as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getValidationResult with error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetValidationResultRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getValidationResult = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getValidationResult(request), expectedError); - assert((client.innerApiCalls.getValidationResult as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('trainAgent', () => { - it('invokes trainAgent without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.TrainAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.trainAgent = stubLongRunningCall(expectedResponse); - const [operation] = await client.trainAgent(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes trainAgent without error using callback', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.TrainAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.trainAgent = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.trainAgent( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes trainAgent with call error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.TrainAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.trainAgent = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.trainAgent(request), expectedError); - assert((client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes trainAgent with LRO error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.TrainAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.trainAgent = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.trainAgent(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkTrainAgentProgress without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkTrainAgentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkTrainAgentProgress with error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkTrainAgentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('exportAgent', () => { - it('invokes exportAgent without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ExportAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.exportAgent = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportAgent(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes exportAgent without error using callback', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ExportAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.exportAgent = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportAgent( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes exportAgent with call error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ExportAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.exportAgent = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportAgent(request), expectedError); - assert((client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes exportAgent with LRO error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ExportAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.exportAgent = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportAgent(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkExportAgentProgress without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExportAgentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportAgentProgress with error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkExportAgentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('importAgent', () => { - it('invokes importAgent without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ImportAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.importAgent = stubLongRunningCall(expectedResponse); - const [operation] = await client.importAgent(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.importAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes importAgent without error using callback', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ImportAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.importAgent = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importAgent( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.importAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes importAgent with call error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ImportAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.importAgent = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importAgent(request), expectedError); - assert((client.innerApiCalls.importAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes importAgent with LRO error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ImportAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.importAgent = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importAgent(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.importAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkImportAgentProgress without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkImportAgentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkImportAgentProgress with error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkImportAgentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('restoreAgent', () => { - it('invokes restoreAgent without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.RestoreAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.restoreAgent = stubLongRunningCall(expectedResponse); - const [operation] = await client.restoreAgent(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes restoreAgent without error using callback', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.RestoreAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.restoreAgent = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restoreAgent( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes restoreAgent with call error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.RestoreAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreAgent = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.restoreAgent(request), expectedError); - assert((client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes restoreAgent with LRO error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.RestoreAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreAgent = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.restoreAgent(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkRestoreAgentProgress without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRestoreAgentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRestoreAgentProgress with error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRestoreAgentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('searchAgents', () => { - it('invokes searchAgents without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SearchAgentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), - ]; - client.innerApiCalls.searchAgents = stubSimpleCall(expectedResponse); - const [response] = await client.searchAgents(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.searchAgents as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes searchAgents without error using callback', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SearchAgentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), - ]; - client.innerApiCalls.searchAgents = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchAgents( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IAgent[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.searchAgents as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes searchAgents with error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SearchAgentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.searchAgents = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchAgents(request), expectedError); - assert((client.innerApiCalls.searchAgents as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes searchAgentsStream without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SearchAgentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), - ]; - client.descriptors.page.searchAgents.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.searchAgentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.Agent[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.Agent) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.searchAgents.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchAgents, request)); - assert.strictEqual( - (client.descriptors.page.searchAgents.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes searchAgentsStream with error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SearchAgentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.searchAgents.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.searchAgentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.Agent[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.Agent) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.searchAgents.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchAgents, request)); - assert.strictEqual( - (client.descriptors.page.searchAgents.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with searchAgents without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SearchAgentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), - ]; - client.descriptors.page.searchAgents.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2.IAgent[] = []; - const iterable = client.searchAgentsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.searchAgents.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.searchAgents.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with searchAgents with error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SearchAgentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.searchAgents.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.searchAgentsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2.IAgent[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.searchAgents.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.searchAgents.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new agentsModule.v2.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.v2.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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new agentsModule.v2.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.v2.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/owl-bot-staging/v2/test/gapic_answer_records_v2.ts b/owl-bot-staging/v2/test/gapic_answer_records_v2.ts deleted file mode 100644 index f290d68c..00000000 --- a/owl-bot-staging/v2/test/gapic_answer_records_v2.ts +++ /dev/null @@ -1,2082 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as answerrecordsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.AnswerRecordsClient', () => { - it('has servicePath', () => { - const servicePath = answerrecordsModule.v2.AnswerRecordsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = answerrecordsModule.v2.AnswerRecordsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = answerrecordsModule.v2.AnswerRecordsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new answerrecordsModule.v2.AnswerRecordsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.answerRecordsStub, undefined); - await client.initialize(); - assert(client.answerRecordsStub); - }); - - it('has close method', () => { - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('updateAnswerRecord', () => { - it('invokes updateAnswerRecord without error', async () => { - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest()); - request.answerRecord = {}; - request.answerRecord.name = ''; - const expectedHeaderRequestParams = "answer_record.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()); - client.innerApiCalls.updateAnswerRecord = stubSimpleCall(expectedResponse); - const [response] = await client.updateAnswerRecord(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateAnswerRecord as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateAnswerRecord without error using callback', async () => { - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest()); - request.answerRecord = {}; - request.answerRecord.name = ''; - const expectedHeaderRequestParams = "answer_record.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()); - client.innerApiCalls.updateAnswerRecord = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAnswerRecord( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IAnswerRecord|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateAnswerRecord as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateAnswerRecord with error', async () => { - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest()); - request.answerRecord = {}; - request.answerRecord.name = ''; - const expectedHeaderRequestParams = "answer_record.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAnswerRecord = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateAnswerRecord(request), expectedError); - assert((client.innerApiCalls.updateAnswerRecord as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listAnswerRecords', () => { - it('invokes listAnswerRecords without error', async () => { - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), - ]; - client.innerApiCalls.listAnswerRecords = stubSimpleCall(expectedResponse); - const [response] = await client.listAnswerRecords(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listAnswerRecords as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listAnswerRecords without error using callback', async () => { - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), - ]; - client.innerApiCalls.listAnswerRecords = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAnswerRecords( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IAnswerRecord[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listAnswerRecords as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listAnswerRecords with error', async () => { - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listAnswerRecords = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAnswerRecords(request), expectedError); - assert((client.innerApiCalls.listAnswerRecords as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listAnswerRecordsStream without error', async () => { - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), - ]; - client.descriptors.page.listAnswerRecords.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAnswerRecordsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.AnswerRecord[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.AnswerRecord) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listAnswerRecords.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAnswerRecords, request)); - assert.strictEqual( - (client.descriptors.page.listAnswerRecords.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listAnswerRecordsStream with error', async () => { - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listAnswerRecords.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAnswerRecordsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.AnswerRecord[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.AnswerRecord) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAnswerRecords.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAnswerRecords, request)); - assert.strictEqual( - (client.descriptors.page.listAnswerRecords.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listAnswerRecords without error', async () => { - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnswerRecord()), - ]; - client.descriptors.page.listAnswerRecords.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2.IAnswerRecord[] = []; - const iterable = client.listAnswerRecordsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listAnswerRecords with error', async () => { - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listAnswerRecords.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAnswerRecordsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2.IAnswerRecord[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - 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 answerrecordsModule.v2.AnswerRecordsClient({ - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - 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 answerrecordsModule.v2.AnswerRecordsClient({ - 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/owl-bot-staging/v2/test/gapic_contexts_v2.ts b/owl-bot-staging/v2/test/gapic_contexts_v2.ts deleted file mode 100644 index fbe35adc..00000000 --- a/owl-bot-staging/v2/test/gapic_contexts_v2.ts +++ /dev/null @@ -1,2456 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as contextsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.ContextsClient', () => { - it('has servicePath', () => { - const servicePath = contextsModule.v2.ContextsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = contextsModule.v2.ContextsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = contextsModule.v2.ContextsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new contextsModule.v2.ContextsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new contextsModule.v2.ContextsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.contextsStub, undefined); - await client.initialize(); - assert(client.contextsStub); - }); - - it('has close method', () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getContext', () => { - it('invokes getContext without error', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetContextRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()); - client.innerApiCalls.getContext = stubSimpleCall(expectedResponse); - const [response] = await client.getContext(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getContext without error using callback', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetContextRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()); - client.innerApiCalls.getContext = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getContext( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IContext|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getContext with error', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetContextRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getContext = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getContext(request), expectedError); - assert((client.innerApiCalls.getContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createContext', () => { - it('invokes createContext without error', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateContextRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()); - client.innerApiCalls.createContext = stubSimpleCall(expectedResponse); - const [response] = await client.createContext(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createContext without error using callback', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateContextRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()); - client.innerApiCalls.createContext = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createContext( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IContext|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createContext with error', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateContextRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createContext = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createContext(request), expectedError); - assert((client.innerApiCalls.createContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateContext', () => { - it('invokes updateContext without error', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateContextRequest()); - request.context = {}; - request.context.name = ''; - const expectedHeaderRequestParams = "context.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()); - client.innerApiCalls.updateContext = stubSimpleCall(expectedResponse); - const [response] = await client.updateContext(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateContext without error using callback', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateContextRequest()); - request.context = {}; - request.context.name = ''; - const expectedHeaderRequestParams = "context.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()); - client.innerApiCalls.updateContext = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateContext( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IContext|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateContext with error', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateContextRequest()); - request.context = {}; - request.context.name = ''; - const expectedHeaderRequestParams = "context.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateContext = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateContext(request), expectedError); - assert((client.innerApiCalls.updateContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteContext', () => { - it('invokes deleteContext without error', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteContextRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteContext = stubSimpleCall(expectedResponse); - const [response] = await client.deleteContext(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteContext without error using callback', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteContextRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteContext = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteContext( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteContext with error', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteContextRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteContext = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteContext(request), expectedError); - assert((client.innerApiCalls.deleteContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteAllContexts', () => { - it('invokes deleteAllContexts without error', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteAllContextsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteAllContexts = stubSimpleCall(expectedResponse); - const [response] = await client.deleteAllContexts(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteAllContexts as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteAllContexts without error using callback', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteAllContextsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteAllContexts = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAllContexts( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteAllContexts as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteAllContexts with error', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteAllContextsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAllContexts = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteAllContexts(request), expectedError); - assert((client.innerApiCalls.deleteAllContexts as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listContexts', () => { - it('invokes listContexts without error', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListContextsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), - ]; - client.innerApiCalls.listContexts = stubSimpleCall(expectedResponse); - const [response] = await client.listContexts(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listContexts as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listContexts without error using callback', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListContextsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), - ]; - client.innerApiCalls.listContexts = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listContexts( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IContext[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listContexts as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listContexts with error', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListContextsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listContexts = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listContexts(request), expectedError); - assert((client.innerApiCalls.listContexts as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listContextsStream without error', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListContextsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), - ]; - client.descriptors.page.listContexts.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listContextsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.Context[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.Context) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listContexts.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listContexts, request)); - assert.strictEqual( - (client.descriptors.page.listContexts.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listContextsStream with error', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListContextsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listContexts.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listContextsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.Context[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.Context) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listContexts.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listContexts, request)); - assert.strictEqual( - (client.descriptors.page.listContexts.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listContexts without error', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListContextsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), - ]; - client.descriptors.page.listContexts.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2.IContext[] = []; - const iterable = client.listContextsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listContexts.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listContexts.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listContexts with error', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListContextsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listContexts.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listContextsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2.IContext[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listContexts.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listContexts.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSession', () => { - const fakePath = "/rendered/path/projectAgentSession"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionPath', () => { - const result = client.projectAgentSessionPath("projectValue", "sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionName', () => { - const result = client.matchProjectFromProjectAgentSessionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionName', () => { - const result = client.matchSessionFromProjectAgentSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new contextsModule.v2.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.v2.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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new contextsModule.v2.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.v2.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/owl-bot-staging/v2/test/gapic_conversation_profiles_v2.ts b/owl-bot-staging/v2/test/gapic_conversation_profiles_v2.ts deleted file mode 100644 index 0cc15558..00000000 --- a/owl-bot-staging/v2/test/gapic_conversation_profiles_v2.ts +++ /dev/null @@ -1,2334 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as conversationprofilesModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.ConversationProfilesClient', () => { - it('has servicePath', () => { - const servicePath = conversationprofilesModule.v2.ConversationProfilesClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = conversationprofilesModule.v2.ConversationProfilesClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = conversationprofilesModule.v2.ConversationProfilesClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.conversationProfilesStub, undefined); - await client.initialize(); - assert(client.conversationProfilesStub); - }); - - it('has close method', () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getConversationProfile', () => { - it('invokes getConversationProfile without error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetConversationProfileRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()); - client.innerApiCalls.getConversationProfile = stubSimpleCall(expectedResponse); - const [response] = await client.getConversationProfile(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getConversationProfile without error using callback', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetConversationProfileRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()); - client.innerApiCalls.getConversationProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getConversationProfile( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversationProfile|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getConversationProfile with error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetConversationProfileRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getConversationProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConversationProfile(request), expectedError); - assert((client.innerApiCalls.getConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createConversationProfile', () => { - it('invokes createConversationProfile without error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateConversationProfileRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()); - client.innerApiCalls.createConversationProfile = stubSimpleCall(expectedResponse); - const [response] = await client.createConversationProfile(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createConversationProfile without error using callback', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateConversationProfileRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()); - client.innerApiCalls.createConversationProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createConversationProfile( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversationProfile|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createConversationProfile with error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateConversationProfileRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createConversationProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createConversationProfile(request), expectedError); - assert((client.innerApiCalls.createConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateConversationProfile', () => { - it('invokes updateConversationProfile without error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateConversationProfileRequest()); - request.conversationProfile = {}; - request.conversationProfile.name = ''; - const expectedHeaderRequestParams = "conversation_profile.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()); - client.innerApiCalls.updateConversationProfile = stubSimpleCall(expectedResponse); - const [response] = await client.updateConversationProfile(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateConversationProfile without error using callback', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateConversationProfileRequest()); - request.conversationProfile = {}; - request.conversationProfile.name = ''; - const expectedHeaderRequestParams = "conversation_profile.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()); - client.innerApiCalls.updateConversationProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateConversationProfile( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversationProfile|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateConversationProfile with error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateConversationProfileRequest()); - request.conversationProfile = {}; - request.conversationProfile.name = ''; - const expectedHeaderRequestParams = "conversation_profile.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateConversationProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateConversationProfile(request), expectedError); - assert((client.innerApiCalls.updateConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteConversationProfile', () => { - it('invokes deleteConversationProfile without error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteConversationProfileRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteConversationProfile = stubSimpleCall(expectedResponse); - const [response] = await client.deleteConversationProfile(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteConversationProfile without error using callback', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteConversationProfileRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteConversationProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteConversationProfile( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteConversationProfile with error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteConversationProfileRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConversationProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteConversationProfile(request), expectedError); - assert((client.innerApiCalls.deleteConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listConversationProfiles', () => { - it('invokes listConversationProfiles without error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), - ]; - client.innerApiCalls.listConversationProfiles = stubSimpleCall(expectedResponse); - const [response] = await client.listConversationProfiles(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listConversationProfiles as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listConversationProfiles without error using callback', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), - ]; - client.innerApiCalls.listConversationProfiles = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listConversationProfiles( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversationProfile[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listConversationProfiles as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listConversationProfiles with error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listConversationProfiles = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listConversationProfiles(request), expectedError); - assert((client.innerApiCalls.listConversationProfiles as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listConversationProfilesStream without error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), - ]; - client.descriptors.page.listConversationProfiles.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listConversationProfilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.ConversationProfile[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.ConversationProfile) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listConversationProfiles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConversationProfiles, request)); - assert.strictEqual( - (client.descriptors.page.listConversationProfiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listConversationProfilesStream with error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listConversationProfiles.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listConversationProfilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.ConversationProfile[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.ConversationProfile) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listConversationProfiles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConversationProfiles, request)); - assert.strictEqual( - (client.descriptors.page.listConversationProfiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listConversationProfiles without error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationProfile()), - ]; - client.descriptors.page.listConversationProfiles.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2.IConversationProfile[] = []; - const iterable = client.listConversationProfilesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listConversationProfiles with error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listConversationProfiles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listConversationProfilesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2.IConversationProfile[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - 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 conversationprofilesModule.v2.ConversationProfilesClient({ - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - 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 conversationprofilesModule.v2.ConversationProfilesClient({ - 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/owl-bot-staging/v2/test/gapic_conversations_v2.ts b/owl-bot-staging/v2/test/gapic_conversations_v2.ts deleted file mode 100644 index ff71baa2..00000000 --- a/owl-bot-staging/v2/test/gapic_conversations_v2.ts +++ /dev/null @@ -1,2470 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as conversationsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.ConversationsClient', () => { - it('has servicePath', () => { - const servicePath = conversationsModule.v2.ConversationsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = conversationsModule.v2.ConversationsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = conversationsModule.v2.ConversationsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new conversationsModule.v2.ConversationsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new conversationsModule.v2.ConversationsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.conversationsStub, undefined); - await client.initialize(); - assert(client.conversationsStub); - }); - - it('has close method', () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('createConversation', () => { - it('invokes createConversation without error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateConversationRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()); - client.innerApiCalls.createConversation = stubSimpleCall(expectedResponse); - const [response] = await client.createConversation(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createConversation without error using callback', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateConversationRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()); - client.innerApiCalls.createConversation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createConversation( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createConversation with error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateConversationRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createConversation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createConversation(request), expectedError); - assert((client.innerApiCalls.createConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getConversation', () => { - it('invokes getConversation without error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetConversationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()); - client.innerApiCalls.getConversation = stubSimpleCall(expectedResponse); - const [response] = await client.getConversation(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getConversation without error using callback', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetConversationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()); - client.innerApiCalls.getConversation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getConversation( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getConversation with error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetConversationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getConversation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConversation(request), expectedError); - assert((client.innerApiCalls.getConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('completeConversation', () => { - it('invokes completeConversation without error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CompleteConversationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()); - client.innerApiCalls.completeConversation = stubSimpleCall(expectedResponse); - const [response] = await client.completeConversation(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.completeConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes completeConversation without error using callback', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CompleteConversationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()); - client.innerApiCalls.completeConversation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.completeConversation( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.completeConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes completeConversation with error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CompleteConversationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.completeConversation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.completeConversation(request), expectedError); - assert((client.innerApiCalls.completeConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listConversations', () => { - it('invokes listConversations without error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), - ]; - client.innerApiCalls.listConversations = stubSimpleCall(expectedResponse); - const [response] = await client.listConversations(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listConversations as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listConversations without error using callback', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), - ]; - client.innerApiCalls.listConversations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listConversations( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listConversations as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listConversations with error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listConversations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listConversations(request), expectedError); - assert((client.innerApiCalls.listConversations as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listConversationsStream without error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), - ]; - client.descriptors.page.listConversations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listConversationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.Conversation[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.Conversation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listConversations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConversations, request)); - assert.strictEqual( - (client.descriptors.page.listConversations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listConversationsStream with error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listConversations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listConversationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.Conversation[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.Conversation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listConversations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConversations, request)); - assert.strictEqual( - (client.descriptors.page.listConversations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listConversations without error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Conversation()), - ]; - client.descriptors.page.listConversations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2.IConversation[] = []; - const iterable = client.listConversationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listConversations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listConversations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listConversations with error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listConversations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listConversationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2.IConversation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listConversations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listConversations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listMessages', () => { - it('invokes listMessages without error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListMessagesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), - ]; - client.innerApiCalls.listMessages = stubSimpleCall(expectedResponse); - const [response] = await client.listMessages(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listMessages as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listMessages without error using callback', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListMessagesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), - ]; - client.innerApiCalls.listMessages = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMessages( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IMessage[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listMessages as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listMessages with error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListMessagesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listMessages = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMessages(request), expectedError); - assert((client.innerApiCalls.listMessages as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listMessagesStream without error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListMessagesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), - ]; - client.descriptors.page.listMessages.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMessagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.Message[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.Message) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listMessages.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMessages, request)); - assert.strictEqual( - (client.descriptors.page.listMessages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listMessagesStream with error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListMessagesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listMessages.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMessagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.Message[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.Message) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMessages.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMessages, request)); - assert.strictEqual( - (client.descriptors.page.listMessages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listMessages without error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListMessagesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), - ]; - client.descriptors.page.listMessages.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2.IMessage[] = []; - const iterable = client.listMessagesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMessages.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listMessages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listMessages with error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListMessagesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listMessages.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMessagesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2.IMessage[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMessages.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listMessages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - 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 conversationsModule.v2.ConversationsClient({ - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - 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 conversationsModule.v2.ConversationsClient({ - 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/owl-bot-staging/v2/test/gapic_documents_v2.ts b/owl-bot-staging/v2/test/gapic_documents_v2.ts deleted file mode 100644 index cbd9c415..00000000 --- a/owl-bot-staging/v2/test/gapic_documents_v2.ts +++ /dev/null @@ -1,2675 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as documentsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.DocumentsClient', () => { - it('has servicePath', () => { - const servicePath = documentsModule.v2.DocumentsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = documentsModule.v2.DocumentsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = documentsModule.v2.DocumentsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new documentsModule.v2.DocumentsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new documentsModule.v2.DocumentsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.documentsStub, undefined); - await client.initialize(); - assert(client.documentsStub); - }); - - it('has close method', () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getDocument', () => { - it('invokes getDocument without error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()); - client.innerApiCalls.getDocument = stubSimpleCall(expectedResponse); - const [response] = await client.getDocument(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getDocument without error using callback', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()); - client.innerApiCalls.getDocument = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDocument( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IDocument|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getDocument with error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getDocument = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDocument(request), expectedError); - assert((client.innerApiCalls.getDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createDocument', () => { - it('invokes createDocument without error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateDocumentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createDocument = stubLongRunningCall(expectedResponse); - const [operation] = await client.createDocument(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createDocument without error using callback', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateDocumentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createDocument = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDocument( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createDocument with call error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateDocumentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createDocument = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createDocument(request), expectedError); - assert((client.innerApiCalls.createDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createDocument with LRO error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateDocumentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createDocument = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createDocument(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateDocumentProgress without error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateDocumentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateDocumentProgress with error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateDocumentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteDocument', () => { - it('invokes deleteDocument without error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteDocument = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteDocument(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteDocument without error using callback', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteDocument = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDocument( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteDocument with call error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDocument = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteDocument(request), expectedError); - assert((client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteDocument with LRO error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDocument = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteDocument(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeleteDocumentProgress without error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteDocumentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteDocumentProgress with error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteDocumentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateDocument', () => { - it('invokes updateDocument without error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateDocumentRequest()); - request.document = {}; - request.document.name = ''; - const expectedHeaderRequestParams = "document.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateDocument = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateDocument(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateDocument without error using callback', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateDocumentRequest()); - request.document = {}; - request.document.name = ''; - const expectedHeaderRequestParams = "document.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateDocument = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDocument( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateDocument with call error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateDocumentRequest()); - request.document = {}; - request.document.name = ''; - const expectedHeaderRequestParams = "document.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDocument = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateDocument(request), expectedError); - assert((client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateDocument with LRO error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateDocumentRequest()); - request.document = {}; - request.document.name = ''; - const expectedHeaderRequestParams = "document.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDocument = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateDocument(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateDocumentProgress without error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateDocumentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateDocumentProgress with error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateDocumentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('reloadDocument', () => { - it('invokes reloadDocument without error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ReloadDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.reloadDocument = stubLongRunningCall(expectedResponse); - const [operation] = await client.reloadDocument(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes reloadDocument without error using callback', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ReloadDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.reloadDocument = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.reloadDocument( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes reloadDocument with call error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ReloadDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.reloadDocument = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.reloadDocument(request), expectedError); - assert((client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes reloadDocument with LRO error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ReloadDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.reloadDocument = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.reloadDocument(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkReloadDocumentProgress without error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkReloadDocumentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkReloadDocumentProgress with error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkReloadDocumentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listDocuments', () => { - it('invokes listDocuments without error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListDocumentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), - ]; - client.innerApiCalls.listDocuments = stubSimpleCall(expectedResponse); - const [response] = await client.listDocuments(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listDocuments as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listDocuments without error using callback', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListDocumentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), - ]; - client.innerApiCalls.listDocuments = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDocuments( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IDocument[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listDocuments as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listDocuments with error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListDocumentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listDocuments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDocuments(request), expectedError); - assert((client.innerApiCalls.listDocuments as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listDocumentsStream without error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListDocumentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), - ]; - client.descriptors.page.listDocuments.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDocumentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.Document[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.Document) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listDocuments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDocuments, request)); - assert.strictEqual( - (client.descriptors.page.listDocuments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listDocumentsStream with error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListDocumentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listDocuments.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDocumentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.Document[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.Document) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDocuments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDocuments, request)); - assert.strictEqual( - (client.descriptors.page.listDocuments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listDocuments without error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListDocumentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), - ]; - client.descriptors.page.listDocuments.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2.IDocument[] = []; - const iterable = client.listDocumentsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDocuments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listDocuments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listDocuments with error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListDocumentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listDocuments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDocumentsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2.IDocument[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDocuments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listDocuments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new documentsModule.v2.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.v2.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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new documentsModule.v2.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.v2.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/owl-bot-staging/v2/test/gapic_entity_types_v2.ts b/owl-bot-staging/v2/test/gapic_entity_types_v2.ts deleted file mode 100644 index 848273be..00000000 --- a/owl-bot-staging/v2/test/gapic_entity_types_v2.ts +++ /dev/null @@ -1,3070 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as entitytypesModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.EntityTypesClient', () => { - it('has servicePath', () => { - const servicePath = entitytypesModule.v2.EntityTypesClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = entitytypesModule.v2.EntityTypesClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = entitytypesModule.v2.EntityTypesClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new entitytypesModule.v2.EntityTypesClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.entityTypesStub, undefined); - await client.initialize(); - assert(client.entityTypesStub); - }); - - it('has close method', () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getEntityType', () => { - it('invokes getEntityType without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()); - client.innerApiCalls.getEntityType = stubSimpleCall(expectedResponse); - const [response] = await client.getEntityType(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getEntityType without error using callback', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()); - client.innerApiCalls.getEntityType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getEntityType( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IEntityType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getEntityType with error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEntityType(request), expectedError); - assert((client.innerApiCalls.getEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createEntityType', () => { - it('invokes createEntityType without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateEntityTypeRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()); - client.innerApiCalls.createEntityType = stubSimpleCall(expectedResponse); - const [response] = await client.createEntityType(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createEntityType without error using callback', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateEntityTypeRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()); - client.innerApiCalls.createEntityType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createEntityType( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IEntityType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createEntityType with error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateEntityTypeRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createEntityType(request), expectedError); - assert((client.innerApiCalls.createEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateEntityType', () => { - it('invokes updateEntityType without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateEntityTypeRequest()); - request.entityType = {}; - request.entityType.name = ''; - const expectedHeaderRequestParams = "entity_type.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()); - client.innerApiCalls.updateEntityType = stubSimpleCall(expectedResponse); - const [response] = await client.updateEntityType(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateEntityType without error using callback', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateEntityTypeRequest()); - request.entityType = {}; - request.entityType.name = ''; - const expectedHeaderRequestParams = "entity_type.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()); - client.innerApiCalls.updateEntityType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateEntityType( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IEntityType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateEntityType with error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateEntityTypeRequest()); - request.entityType = {}; - request.entityType.name = ''; - const expectedHeaderRequestParams = "entity_type.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateEntityType(request), expectedError); - assert((client.innerApiCalls.updateEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteEntityType', () => { - it('invokes deleteEntityType without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteEntityType = stubSimpleCall(expectedResponse); - const [response] = await client.deleteEntityType(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteEntityType without error using callback', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteEntityType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteEntityType( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteEntityType with error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteEntityType(request), expectedError); - assert((client.innerApiCalls.deleteEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('batchUpdateEntityTypes', () => { - it('invokes batchUpdateEntityTypes without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall(expectedResponse); - const [operation] = await client.batchUpdateEntityTypes(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchUpdateEntityTypes without error using callback', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchUpdateEntityTypes( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes batchUpdateEntityTypes with call error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchUpdateEntityTypes(request), expectedError); - assert((client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchUpdateEntityTypes with LRO error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchUpdateEntityTypes(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkBatchUpdateEntityTypesProgress without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkBatchUpdateEntityTypesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBatchUpdateEntityTypesProgress with error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkBatchUpdateEntityTypesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('batchDeleteEntityTypes', () => { - it('invokes batchDeleteEntityTypes without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall(expectedResponse); - const [operation] = await client.batchDeleteEntityTypes(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchDeleteEntityTypes without error using callback', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchDeleteEntityTypes( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes batchDeleteEntityTypes with call error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchDeleteEntityTypes(request), expectedError); - assert((client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchDeleteEntityTypes with LRO error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchDeleteEntityTypes(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkBatchDeleteEntityTypesProgress without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkBatchDeleteEntityTypesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBatchDeleteEntityTypesProgress with error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkBatchDeleteEntityTypesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('batchCreateEntities', () => { - it('invokes batchCreateEntities without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchCreateEntities = stubLongRunningCall(expectedResponse); - const [operation] = await client.batchCreateEntities(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchCreateEntities without error using callback', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchCreateEntities = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchCreateEntities( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes batchCreateEntities with call error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchCreateEntities = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchCreateEntities(request), expectedError); - assert((client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchCreateEntities with LRO error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchCreateEntities = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchCreateEntities(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkBatchCreateEntitiesProgress without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkBatchCreateEntitiesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBatchCreateEntitiesProgress with error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkBatchCreateEntitiesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('batchUpdateEntities', () => { - it('invokes batchUpdateEntities without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchUpdateEntities = stubLongRunningCall(expectedResponse); - const [operation] = await client.batchUpdateEntities(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchUpdateEntities without error using callback', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchUpdateEntities = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchUpdateEntities( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes batchUpdateEntities with call error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateEntities = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchUpdateEntities(request), expectedError); - assert((client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchUpdateEntities with LRO error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateEntities = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchUpdateEntities(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkBatchUpdateEntitiesProgress without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkBatchUpdateEntitiesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBatchUpdateEntitiesProgress with error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkBatchUpdateEntitiesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('batchDeleteEntities', () => { - it('invokes batchDeleteEntities without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchDeleteEntities = stubLongRunningCall(expectedResponse); - const [operation] = await client.batchDeleteEntities(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchDeleteEntities without error using callback', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchDeleteEntities = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchDeleteEntities( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes batchDeleteEntities with call error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteEntities = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchDeleteEntities(request), expectedError); - assert((client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchDeleteEntities with LRO error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteEntities = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchDeleteEntities(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkBatchDeleteEntitiesProgress without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkBatchDeleteEntitiesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBatchDeleteEntitiesProgress with error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkBatchDeleteEntitiesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listEntityTypes', () => { - it('invokes listEntityTypes without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), - ]; - client.innerApiCalls.listEntityTypes = stubSimpleCall(expectedResponse); - const [response] = await client.listEntityTypes(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listEntityTypes without error using callback', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), - ]; - client.innerApiCalls.listEntityTypes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listEntityTypes( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IEntityType[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listEntityTypes with error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listEntityTypes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listEntityTypes(request), expectedError); - assert((client.innerApiCalls.listEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listEntityTypesStream without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), - ]; - client.descriptors.page.listEntityTypes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listEntityTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.EntityType[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.EntityType) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listEntityTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listEntityTypes, request)); - assert.strictEqual( - (client.descriptors.page.listEntityTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listEntityTypesStream with error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listEntityTypes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listEntityTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.EntityType[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.EntityType) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listEntityTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listEntityTypes, request)); - assert.strictEqual( - (client.descriptors.page.listEntityTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listEntityTypes without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EntityType()), - ]; - client.descriptors.page.listEntityTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2.IEntityType[] = []; - const iterable = client.listEntityTypesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listEntityTypes with error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listEntityTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listEntityTypesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2.IEntityType[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new entitytypesModule.v2.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.v2.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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new entitytypesModule.v2.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.v2.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/owl-bot-staging/v2/test/gapic_environments_v2.ts b/owl-bot-staging/v2/test/gapic_environments_v2.ts deleted file mode 100644 index e1d153e7..00000000 --- a/owl-bot-staging/v2/test/gapic_environments_v2.ts +++ /dev/null @@ -1,2557 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as environmentsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.EnvironmentsClient', () => { - it('has servicePath', () => { - const servicePath = environmentsModule.v2.EnvironmentsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = environmentsModule.v2.EnvironmentsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = environmentsModule.v2.EnvironmentsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new environmentsModule.v2.EnvironmentsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.environmentsStub, undefined); - await client.initialize(); - assert(client.environmentsStub); - }); - - it('has close method', () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getEnvironment', () => { - it('invokes getEnvironment without error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEnvironmentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()); - client.innerApiCalls.getEnvironment = stubSimpleCall(expectedResponse); - const [response] = await client.getEnvironment(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getEnvironment without error using callback', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEnvironmentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()); - client.innerApiCalls.getEnvironment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getEnvironment( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IEnvironment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getEnvironment with error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEnvironmentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getEnvironment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEnvironment(request), expectedError); - assert((client.innerApiCalls.getEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createEnvironment', () => { - it('invokes createEnvironment without error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateEnvironmentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()); - client.innerApiCalls.createEnvironment = stubSimpleCall(expectedResponse); - const [response] = await client.createEnvironment(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createEnvironment without error using callback', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateEnvironmentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()); - client.innerApiCalls.createEnvironment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createEnvironment( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IEnvironment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createEnvironment with error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateEnvironmentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createEnvironment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createEnvironment(request), expectedError); - assert((client.innerApiCalls.createEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateEnvironment', () => { - it('invokes updateEnvironment without error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateEnvironmentRequest()); - request.environment = {}; - request.environment.name = ''; - const expectedHeaderRequestParams = "environment.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()); - client.innerApiCalls.updateEnvironment = stubSimpleCall(expectedResponse); - const [response] = await client.updateEnvironment(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateEnvironment without error using callback', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateEnvironmentRequest()); - request.environment = {}; - request.environment.name = ''; - const expectedHeaderRequestParams = "environment.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()); - client.innerApiCalls.updateEnvironment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateEnvironment( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IEnvironment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateEnvironment with error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateEnvironmentRequest()); - request.environment = {}; - request.environment.name = ''; - const expectedHeaderRequestParams = "environment.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateEnvironment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateEnvironment(request), expectedError); - assert((client.innerApiCalls.updateEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteEnvironment', () => { - it('invokes deleteEnvironment without error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteEnvironmentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteEnvironment = stubSimpleCall(expectedResponse); - const [response] = await client.deleteEnvironment(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteEnvironment without error using callback', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteEnvironmentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteEnvironment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteEnvironment( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteEnvironment with error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteEnvironmentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteEnvironment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteEnvironment(request), expectedError); - assert((client.innerApiCalls.deleteEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listEnvironments', () => { - it('invokes listEnvironments without error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), - ]; - client.innerApiCalls.listEnvironments = stubSimpleCall(expectedResponse); - const [response] = await client.listEnvironments(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listEnvironments as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listEnvironments without error using callback', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), - ]; - client.innerApiCalls.listEnvironments = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listEnvironments( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IEnvironment[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listEnvironments as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listEnvironments with error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listEnvironments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listEnvironments(request), expectedError); - assert((client.innerApiCalls.listEnvironments as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listEnvironmentsStream without error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), - ]; - client.descriptors.page.listEnvironments.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listEnvironmentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.Environment[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.Environment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listEnvironments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listEnvironments, request)); - assert.strictEqual( - (client.descriptors.page.listEnvironments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listEnvironmentsStream with error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listEnvironments.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listEnvironmentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.Environment[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.Environment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listEnvironments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listEnvironments, request)); - assert.strictEqual( - (client.descriptors.page.listEnvironments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listEnvironments without error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Environment()), - ]; - client.descriptors.page.listEnvironments.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2.IEnvironment[] = []; - const iterable = client.listEnvironmentsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listEnvironments with error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listEnvironments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listEnvironmentsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2.IEnvironment[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('getEnvironmentHistory', () => { - it('invokes getEnvironmentHistory without error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), - ]; - client.innerApiCalls.getEnvironmentHistory = stubSimpleCall(expectedResponse); - const [response] = await client.getEnvironmentHistory(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getEnvironmentHistory as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getEnvironmentHistory without error using callback', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), - ]; - client.innerApiCalls.getEnvironmentHistory = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getEnvironmentHistory( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getEnvironmentHistory as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getEnvironmentHistory with error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getEnvironmentHistory = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEnvironmentHistory(request), expectedError); - assert((client.innerApiCalls.getEnvironmentHistory as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getEnvironmentHistoryStream without error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), - ]; - client.descriptors.page.getEnvironmentHistory.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.getEnvironmentHistoryStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.getEnvironmentHistory, request)); - assert.strictEqual( - (client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes getEnvironmentHistoryStream with error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.getEnvironmentHistory.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.getEnvironmentHistoryStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.getEnvironmentHistory, request)); - assert.strictEqual( - (client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with getEnvironmentHistory without error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry()), - ]; - client.descriptors.page.getEnvironmentHistory.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry[] = []; - const iterable = client.getEnvironmentHistoryAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with getEnvironmentHistory with error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.getEnvironmentHistory.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.getEnvironmentHistoryAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new environmentsModule.v2.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.v2.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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new environmentsModule.v2.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.v2.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/owl-bot-staging/v2/test/gapic_fulfillments_v2.ts b/owl-bot-staging/v2/test/gapic_fulfillments_v2.ts deleted file mode 100644 index ec0e896f..00000000 --- a/owl-bot-staging/v2/test/gapic_fulfillments_v2.ts +++ /dev/null @@ -1,1866 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as fulfillmentsModule from '../src'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v2.FulfillmentsClient', () => { - it('has servicePath', () => { - const servicePath = fulfillmentsModule.v2.FulfillmentsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = fulfillmentsModule.v2.FulfillmentsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = fulfillmentsModule.v2.FulfillmentsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new fulfillmentsModule.v2.FulfillmentsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.fulfillmentsStub, undefined); - await client.initialize(); - assert(client.fulfillmentsStub); - }); - - it('has close method', () => { - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getFulfillment', () => { - it('invokes getFulfillment without error', async () => { - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetFulfillmentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Fulfillment()); - client.innerApiCalls.getFulfillment = stubSimpleCall(expectedResponse); - const [response] = await client.getFulfillment(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getFulfillment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getFulfillment without error using callback', async () => { - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetFulfillmentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Fulfillment()); - client.innerApiCalls.getFulfillment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFulfillment( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IFulfillment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getFulfillment as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getFulfillment with error', async () => { - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetFulfillmentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getFulfillment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFulfillment(request), expectedError); - assert((client.innerApiCalls.getFulfillment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateFulfillment', () => { - it('invokes updateFulfillment without error', async () => { - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateFulfillmentRequest()); - request.fulfillment = {}; - request.fulfillment.name = ''; - const expectedHeaderRequestParams = "fulfillment.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Fulfillment()); - client.innerApiCalls.updateFulfillment = stubSimpleCall(expectedResponse); - const [response] = await client.updateFulfillment(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateFulfillment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateFulfillment without error using callback', async () => { - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateFulfillmentRequest()); - request.fulfillment = {}; - request.fulfillment.name = ''; - const expectedHeaderRequestParams = "fulfillment.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Fulfillment()); - client.innerApiCalls.updateFulfillment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFulfillment( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IFulfillment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateFulfillment as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateFulfillment with error', async () => { - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateFulfillmentRequest()); - request.fulfillment = {}; - request.fulfillment.name = ''; - const expectedHeaderRequestParams = "fulfillment.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFulfillment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateFulfillment(request), expectedError); - assert((client.innerApiCalls.updateFulfillment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('Path templates', () => { - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - 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 fulfillmentsModule.v2.FulfillmentsClient({ - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - 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 fulfillmentsModule.v2.FulfillmentsClient({ - 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/owl-bot-staging/v2/test/gapic_intents_v2.ts b/owl-bot-staging/v2/test/gapic_intents_v2.ts deleted file mode 100644 index 1266fac0..00000000 --- a/owl-bot-staging/v2/test/gapic_intents_v2.ts +++ /dev/null @@ -1,2638 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as intentsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.IntentsClient', () => { - it('has servicePath', () => { - const servicePath = intentsModule.v2.IntentsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = intentsModule.v2.IntentsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = intentsModule.v2.IntentsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new intentsModule.v2.IntentsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new intentsModule.v2.IntentsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.intentsStub, undefined); - await client.initialize(); - assert(client.intentsStub); - }); - - it('has close method', () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getIntent', () => { - it('invokes getIntent without error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetIntentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()); - client.innerApiCalls.getIntent = stubSimpleCall(expectedResponse); - const [response] = await client.getIntent(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getIntent without error using callback', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetIntentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()); - client.innerApiCalls.getIntent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIntent( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IIntent|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getIntent with error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetIntentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getIntent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIntent(request), expectedError); - assert((client.innerApiCalls.getIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createIntent', () => { - it('invokes createIntent without error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateIntentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()); - client.innerApiCalls.createIntent = stubSimpleCall(expectedResponse); - const [response] = await client.createIntent(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createIntent without error using callback', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateIntentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()); - client.innerApiCalls.createIntent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createIntent( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IIntent|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createIntent with error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateIntentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createIntent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createIntent(request), expectedError); - assert((client.innerApiCalls.createIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateIntent', () => { - it('invokes updateIntent without error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateIntentRequest()); - request.intent = {}; - request.intent.name = ''; - const expectedHeaderRequestParams = "intent.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()); - client.innerApiCalls.updateIntent = stubSimpleCall(expectedResponse); - const [response] = await client.updateIntent(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateIntent without error using callback', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateIntentRequest()); - request.intent = {}; - request.intent.name = ''; - const expectedHeaderRequestParams = "intent.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()); - client.innerApiCalls.updateIntent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateIntent( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IIntent|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateIntent with error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateIntentRequest()); - request.intent = {}; - request.intent.name = ''; - const expectedHeaderRequestParams = "intent.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateIntent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateIntent(request), expectedError); - assert((client.innerApiCalls.updateIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteIntent', () => { - it('invokes deleteIntent without error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteIntentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteIntent = stubSimpleCall(expectedResponse); - const [response] = await client.deleteIntent(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteIntent without error using callback', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteIntentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteIntent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteIntent( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteIntent with error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteIntentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteIntent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteIntent(request), expectedError); - assert((client.innerApiCalls.deleteIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('batchUpdateIntents', () => { - it('invokes batchUpdateIntents without error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchUpdateIntents = stubLongRunningCall(expectedResponse); - const [operation] = await client.batchUpdateIntents(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchUpdateIntents without error using callback', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchUpdateIntents = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchUpdateIntents( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes batchUpdateIntents with call error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateIntents = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchUpdateIntents(request), expectedError); - assert((client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchUpdateIntents with LRO error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateIntents = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchUpdateIntents(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkBatchUpdateIntentsProgress without error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkBatchUpdateIntentsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBatchUpdateIntentsProgress with error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkBatchUpdateIntentsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('batchDeleteIntents', () => { - it('invokes batchDeleteIntents without error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchDeleteIntents = stubLongRunningCall(expectedResponse); - const [operation] = await client.batchDeleteIntents(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchDeleteIntents without error using callback', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchDeleteIntents = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchDeleteIntents( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes batchDeleteIntents with call error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteIntents = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchDeleteIntents(request), expectedError); - assert((client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchDeleteIntents with LRO error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteIntents = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchDeleteIntents(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkBatchDeleteIntentsProgress without error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkBatchDeleteIntentsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBatchDeleteIntentsProgress with error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkBatchDeleteIntentsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listIntents', () => { - it('invokes listIntents without error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), - ]; - client.innerApiCalls.listIntents = stubSimpleCall(expectedResponse); - const [response] = await client.listIntents(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listIntents without error using callback', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), - ]; - client.innerApiCalls.listIntents = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listIntents( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IIntent[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listIntents with error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listIntents = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listIntents(request), expectedError); - assert((client.innerApiCalls.listIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listIntentsStream without error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), - ]; - client.descriptors.page.listIntents.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listIntentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.Intent[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.Intent) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listIntents.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listIntents, request)); - assert.strictEqual( - (client.descriptors.page.listIntents.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listIntentsStream with error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listIntents.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listIntentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.Intent[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.Intent) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listIntents.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listIntents, request)); - assert.strictEqual( - (client.descriptors.page.listIntents.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listIntents without error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), - ]; - client.descriptors.page.listIntents.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2.IIntent[] = []; - const iterable = client.listIntentsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listIntents.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listIntents.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listIntents with error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listIntents.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listIntentsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2.IIntent[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listIntents.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listIntents.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new intentsModule.v2.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.v2.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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new intentsModule.v2.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.v2.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/owl-bot-staging/v2/test/gapic_knowledge_bases_v2.ts b/owl-bot-staging/v2/test/gapic_knowledge_bases_v2.ts deleted file mode 100644 index 338a4b04..00000000 --- a/owl-bot-staging/v2/test/gapic_knowledge_bases_v2.ts +++ /dev/null @@ -1,2334 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as knowledgebasesModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.KnowledgeBasesClient', () => { - it('has servicePath', () => { - const servicePath = knowledgebasesModule.v2.KnowledgeBasesClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = knowledgebasesModule.v2.KnowledgeBasesClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = knowledgebasesModule.v2.KnowledgeBasesClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.knowledgeBasesStub, undefined); - await client.initialize(); - assert(client.knowledgeBasesStub); - }); - - it('has close method', () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getKnowledgeBase', () => { - it('invokes getKnowledgeBase without error', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()); - client.innerApiCalls.getKnowledgeBase = stubSimpleCall(expectedResponse); - const [response] = await client.getKnowledgeBase(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getKnowledgeBase without error using callback', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()); - client.innerApiCalls.getKnowledgeBase = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getKnowledgeBase( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IKnowledgeBase|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getKnowledgeBase with error', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getKnowledgeBase = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getKnowledgeBase(request), expectedError); - assert((client.innerApiCalls.getKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createKnowledgeBase', () => { - it('invokes createKnowledgeBase without error', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()); - client.innerApiCalls.createKnowledgeBase = stubSimpleCall(expectedResponse); - const [response] = await client.createKnowledgeBase(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createKnowledgeBase without error using callback', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()); - client.innerApiCalls.createKnowledgeBase = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createKnowledgeBase( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IKnowledgeBase|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createKnowledgeBase with error', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createKnowledgeBase = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createKnowledgeBase(request), expectedError); - assert((client.innerApiCalls.createKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteKnowledgeBase', () => { - it('invokes deleteKnowledgeBase without error', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteKnowledgeBase = stubSimpleCall(expectedResponse); - const [response] = await client.deleteKnowledgeBase(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteKnowledgeBase without error using callback', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteKnowledgeBase = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteKnowledgeBase( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteKnowledgeBase with error', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteKnowledgeBase = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteKnowledgeBase(request), expectedError); - assert((client.innerApiCalls.deleteKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateKnowledgeBase', () => { - it('invokes updateKnowledgeBase without error', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest()); - request.knowledgeBase = {}; - request.knowledgeBase.name = ''; - const expectedHeaderRequestParams = "knowledge_base.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()); - client.innerApiCalls.updateKnowledgeBase = stubSimpleCall(expectedResponse); - const [response] = await client.updateKnowledgeBase(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateKnowledgeBase without error using callback', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest()); - request.knowledgeBase = {}; - request.knowledgeBase.name = ''; - const expectedHeaderRequestParams = "knowledge_base.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()); - client.innerApiCalls.updateKnowledgeBase = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateKnowledgeBase( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IKnowledgeBase|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateKnowledgeBase with error', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest()); - request.knowledgeBase = {}; - request.knowledgeBase.name = ''; - const expectedHeaderRequestParams = "knowledge_base.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateKnowledgeBase = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateKnowledgeBase(request), expectedError); - assert((client.innerApiCalls.updateKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listKnowledgeBases', () => { - it('invokes listKnowledgeBases without error', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), - ]; - client.innerApiCalls.listKnowledgeBases = stubSimpleCall(expectedResponse); - const [response] = await client.listKnowledgeBases(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listKnowledgeBases as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listKnowledgeBases without error using callback', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), - ]; - client.innerApiCalls.listKnowledgeBases = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listKnowledgeBases( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IKnowledgeBase[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listKnowledgeBases as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listKnowledgeBases with error', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listKnowledgeBases = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listKnowledgeBases(request), expectedError); - assert((client.innerApiCalls.listKnowledgeBases as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listKnowledgeBasesStream without error', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), - ]; - client.descriptors.page.listKnowledgeBases.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listKnowledgeBasesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.KnowledgeBase[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.KnowledgeBase) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listKnowledgeBases.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listKnowledgeBases, request)); - assert.strictEqual( - (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listKnowledgeBasesStream with error', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listKnowledgeBases.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listKnowledgeBasesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.KnowledgeBase[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.KnowledgeBase) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listKnowledgeBases.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listKnowledgeBases, request)); - assert.strictEqual( - (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listKnowledgeBases without error', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.KnowledgeBase()), - ]; - client.descriptors.page.listKnowledgeBases.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2.IKnowledgeBase[] = []; - const iterable = client.listKnowledgeBasesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listKnowledgeBases with error', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listKnowledgeBases.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listKnowledgeBasesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2.IKnowledgeBase[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new knowledgebasesModule.v2.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.v2.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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new knowledgebasesModule.v2.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.v2.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/owl-bot-staging/v2/test/gapic_participants_v2.ts b/owl-bot-staging/v2/test/gapic_participants_v2.ts deleted file mode 100644 index 3fb660af..00000000 --- a/owl-bot-staging/v2/test/gapic_participants_v2.ts +++ /dev/null @@ -1,2502 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as participantsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.ParticipantsClient', () => { - it('has servicePath', () => { - const servicePath = participantsModule.v2.ParticipantsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = participantsModule.v2.ParticipantsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = participantsModule.v2.ParticipantsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new participantsModule.v2.ParticipantsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new participantsModule.v2.ParticipantsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.participantsStub, undefined); - await client.initialize(); - assert(client.participantsStub); - }); - - it('has close method', () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('createParticipant', () => { - it('invokes createParticipant without error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateParticipantRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()); - client.innerApiCalls.createParticipant = stubSimpleCall(expectedResponse); - const [response] = await client.createParticipant(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createParticipant as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createParticipant without error using callback', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateParticipantRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()); - client.innerApiCalls.createParticipant = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createParticipant( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IParticipant|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createParticipant as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createParticipant with error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateParticipantRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createParticipant = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createParticipant(request), expectedError); - assert((client.innerApiCalls.createParticipant as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getParticipant', () => { - it('invokes getParticipant without error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetParticipantRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()); - client.innerApiCalls.getParticipant = stubSimpleCall(expectedResponse); - const [response] = await client.getParticipant(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getParticipant as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getParticipant without error using callback', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetParticipantRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()); - client.innerApiCalls.getParticipant = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getParticipant( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IParticipant|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getParticipant as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getParticipant with error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetParticipantRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getParticipant = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getParticipant(request), expectedError); - assert((client.innerApiCalls.getParticipant as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateParticipant', () => { - it('invokes updateParticipant without error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateParticipantRequest()); - request.participant = {}; - request.participant.name = ''; - const expectedHeaderRequestParams = "participant.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()); - client.innerApiCalls.updateParticipant = stubSimpleCall(expectedResponse); - const [response] = await client.updateParticipant(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateParticipant as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateParticipant without error using callback', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateParticipantRequest()); - request.participant = {}; - request.participant.name = ''; - const expectedHeaderRequestParams = "participant.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()); - client.innerApiCalls.updateParticipant = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateParticipant( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IParticipant|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateParticipant as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateParticipant with error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateParticipantRequest()); - request.participant = {}; - request.participant.name = ''; - const expectedHeaderRequestParams = "participant.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateParticipant = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateParticipant(request), expectedError); - assert((client.innerApiCalls.updateParticipant as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('analyzeContent', () => { - it('invokes analyzeContent without error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnalyzeContentRequest()); - request.participant = ''; - const expectedHeaderRequestParams = "participant="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnalyzeContentResponse()); - client.innerApiCalls.analyzeContent = stubSimpleCall(expectedResponse); - const [response] = await client.analyzeContent(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.analyzeContent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes analyzeContent without error using callback', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnalyzeContentRequest()); - request.participant = ''; - const expectedHeaderRequestParams = "participant="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnalyzeContentResponse()); - client.innerApiCalls.analyzeContent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.analyzeContent( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.analyzeContent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes analyzeContent with error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.AnalyzeContentRequest()); - request.participant = ''; - const expectedHeaderRequestParams = "participant="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeContent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.analyzeContent(request), expectedError); - assert((client.innerApiCalls.analyzeContent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('suggestArticles', () => { - it('invokes suggestArticles without error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SuggestArticlesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SuggestArticlesResponse()); - client.innerApiCalls.suggestArticles = stubSimpleCall(expectedResponse); - const [response] = await client.suggestArticles(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.suggestArticles as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes suggestArticles without error using callback', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SuggestArticlesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SuggestArticlesResponse()); - client.innerApiCalls.suggestArticles = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.suggestArticles( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.suggestArticles as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes suggestArticles with error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SuggestArticlesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.suggestArticles = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.suggestArticles(request), expectedError); - assert((client.innerApiCalls.suggestArticles as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('suggestFaqAnswers', () => { - it('invokes suggestFaqAnswers without error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SuggestFaqAnswersResponse()); - client.innerApiCalls.suggestFaqAnswers = stubSimpleCall(expectedResponse); - const [response] = await client.suggestFaqAnswers(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.suggestFaqAnswers as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes suggestFaqAnswers without error using callback', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SuggestFaqAnswersResponse()); - client.innerApiCalls.suggestFaqAnswers = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.suggestFaqAnswers( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.suggestFaqAnswers as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes suggestFaqAnswers with error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.suggestFaqAnswers = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.suggestFaqAnswers(request), expectedError); - assert((client.innerApiCalls.suggestFaqAnswers as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listParticipants', () => { - it('invokes listParticipants without error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListParticipantsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), - ]; - client.innerApiCalls.listParticipants = stubSimpleCall(expectedResponse); - const [response] = await client.listParticipants(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listParticipants as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listParticipants without error using callback', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListParticipantsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), - ]; - client.innerApiCalls.listParticipants = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listParticipants( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IParticipant[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listParticipants as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listParticipants with error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListParticipantsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listParticipants = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listParticipants(request), expectedError); - assert((client.innerApiCalls.listParticipants as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listParticipantsStream without error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListParticipantsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), - ]; - client.descriptors.page.listParticipants.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listParticipantsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.Participant[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.Participant) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listParticipants.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listParticipants, request)); - assert.strictEqual( - (client.descriptors.page.listParticipants.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listParticipantsStream with error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListParticipantsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listParticipants.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listParticipantsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.Participant[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.Participant) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listParticipants.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listParticipants, request)); - assert.strictEqual( - (client.descriptors.page.listParticipants.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listParticipants without error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListParticipantsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Participant()), - ]; - client.descriptors.page.listParticipants.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2.IParticipant[] = []; - const iterable = client.listParticipantsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listParticipants.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listParticipants.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listParticipants with error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListParticipantsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listParticipants.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listParticipantsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2.IParticipant[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listParticipants.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listParticipants.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - 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 participantsModule.v2.ParticipantsClient({ - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - 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 participantsModule.v2.ParticipantsClient({ - 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/owl-bot-staging/v2/test/gapic_session_entity_types_v2.ts b/owl-bot-staging/v2/test/gapic_session_entity_types_v2.ts deleted file mode 100644 index c76ee104..00000000 --- a/owl-bot-staging/v2/test/gapic_session_entity_types_v2.ts +++ /dev/null @@ -1,2372 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as sessionentitytypesModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.SessionEntityTypesClient', () => { - it('has servicePath', () => { - const servicePath = sessionentitytypesModule.v2.SessionEntityTypesClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = sessionentitytypesModule.v2.SessionEntityTypesClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = sessionentitytypesModule.v2.SessionEntityTypesClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sessionEntityTypesStub, undefined); - await client.initialize(); - assert(client.sessionEntityTypesStub); - }); - - it('has close method', () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getSessionEntityType', () => { - it('invokes getSessionEntityType without error', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()); - client.innerApiCalls.getSessionEntityType = stubSimpleCall(expectedResponse); - const [response] = await client.getSessionEntityType(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getSessionEntityType without error using callback', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()); - client.innerApiCalls.getSessionEntityType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSessionEntityType( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.ISessionEntityType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getSessionEntityType with error', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getSessionEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSessionEntityType(request), expectedError); - assert((client.innerApiCalls.getSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createSessionEntityType', () => { - it('invokes createSessionEntityType without error', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()); - client.innerApiCalls.createSessionEntityType = stubSimpleCall(expectedResponse); - const [response] = await client.createSessionEntityType(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createSessionEntityType without error using callback', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()); - client.innerApiCalls.createSessionEntityType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSessionEntityType( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.ISessionEntityType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createSessionEntityType with error', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createSessionEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSessionEntityType(request), expectedError); - assert((client.innerApiCalls.createSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateSessionEntityType', () => { - it('invokes updateSessionEntityType without error', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest()); - request.sessionEntityType = {}; - request.sessionEntityType.name = ''; - const expectedHeaderRequestParams = "session_entity_type.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()); - client.innerApiCalls.updateSessionEntityType = stubSimpleCall(expectedResponse); - const [response] = await client.updateSessionEntityType(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateSessionEntityType without error using callback', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest()); - request.sessionEntityType = {}; - request.sessionEntityType.name = ''; - const expectedHeaderRequestParams = "session_entity_type.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()); - client.innerApiCalls.updateSessionEntityType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSessionEntityType( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.ISessionEntityType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateSessionEntityType with error', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest()); - request.sessionEntityType = {}; - request.sessionEntityType.name = ''; - const expectedHeaderRequestParams = "session_entity_type.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSessionEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSessionEntityType(request), expectedError); - assert((client.innerApiCalls.updateSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteSessionEntityType', () => { - it('invokes deleteSessionEntityType without error', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteSessionEntityType = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSessionEntityType(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteSessionEntityType without error using callback', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteSessionEntityType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSessionEntityType( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteSessionEntityType with error', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSessionEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSessionEntityType(request), expectedError); - assert((client.innerApiCalls.deleteSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listSessionEntityTypes', () => { - it('invokes listSessionEntityTypes without error', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), - ]; - client.innerApiCalls.listSessionEntityTypes = stubSimpleCall(expectedResponse); - const [response] = await client.listSessionEntityTypes(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSessionEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSessionEntityTypes without error using callback', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), - ]; - client.innerApiCalls.listSessionEntityTypes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSessionEntityTypes( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.ISessionEntityType[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSessionEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listSessionEntityTypes with error', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listSessionEntityTypes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSessionEntityTypes(request), expectedError); - assert((client.innerApiCalls.listSessionEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSessionEntityTypesStream without error', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), - ]; - client.descriptors.page.listSessionEntityTypes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSessionEntityTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.SessionEntityType[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.SessionEntityType) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSessionEntityTypes, request)); - assert.strictEqual( - (client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listSessionEntityTypesStream with error', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listSessionEntityTypes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSessionEntityTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.SessionEntityType[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.SessionEntityType) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSessionEntityTypes, request)); - assert.strictEqual( - (client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSessionEntityTypes without error', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.SessionEntityType()), - ]; - client.descriptors.page.listSessionEntityTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2.ISessionEntityType[] = []; - const iterable = client.listSessionEntityTypesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSessionEntityTypes with error', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listSessionEntityTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSessionEntityTypesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2.ISessionEntityType[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSession', () => { - const fakePath = "/rendered/path/projectAgentSession"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionPath', () => { - const result = client.projectAgentSessionPath("projectValue", "sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionName', () => { - const result = client.matchProjectFromProjectAgentSessionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionName', () => { - const result = client.matchSessionFromProjectAgentSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new sessionentitytypesModule.v2.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.v2.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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new sessionentitytypesModule.v2.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.v2.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/owl-bot-staging/v2/test/gapic_sessions_v2.ts b/owl-bot-staging/v2/test/gapic_sessions_v2.ts deleted file mode 100644 index f333f350..00000000 --- a/owl-bot-staging/v2/test/gapic_sessions_v2.ts +++ /dev/null @@ -1,2046 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as sessionsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubBidiStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream); -} - -describe('v2.SessionsClient', () => { - it('has servicePath', () => { - const servicePath = sessionsModule.v2.SessionsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = sessionsModule.v2.SessionsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = sessionsModule.v2.SessionsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new sessionsModule.v2.SessionsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sessionsModule.v2.SessionsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sessionsStub, undefined); - await client.initialize(); - assert(client.sessionsStub); - }); - - it('has close method', () => { - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('detectIntent', () => { - it('invokes detectIntent without error', async () => { - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DetectIntentRequest()); - request.session = ''; - const expectedHeaderRequestParams = "session="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DetectIntentResponse()); - client.innerApiCalls.detectIntent = stubSimpleCall(expectedResponse); - const [response] = await client.detectIntent(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.detectIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes detectIntent without error using callback', async () => { - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DetectIntentRequest()); - request.session = ''; - const expectedHeaderRequestParams = "session="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DetectIntentResponse()); - client.innerApiCalls.detectIntent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.detectIntent( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IDetectIntentResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.detectIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes detectIntent with error', async () => { - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DetectIntentRequest()); - request.session = ''; - const expectedHeaderRequestParams = "session="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.detectIntent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.detectIntent(request), expectedError); - assert((client.innerApiCalls.detectIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('streamingDetectIntent', () => { - it('invokes streamingDetectIntent without error', async () => { - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.StreamingDetectIntentRequest()); - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.StreamingDetectIntentResponse()); - client.innerApiCalls.streamingDetectIntent = stubBidiStreamingCall(expectedResponse); - const stream = client.streamingDetectIntent(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.dialogflow.v2.StreamingDetectIntentResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.streamingDetectIntent as SinonStub) - .getCall(0).calledWithExactly(undefined)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes streamingDetectIntent with error', async () => { - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.StreamingDetectIntentRequest());const expectedError = new Error('expected'); - client.innerApiCalls.streamingDetectIntent = stubBidiStreamingCall(undefined, expectedError); - const stream = client.streamingDetectIntent(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.dialogflow.v2.StreamingDetectIntentResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.streamingDetectIntent as SinonStub) - .getCall(0).calledWithExactly(undefined)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); - - describe('Path templates', () => { - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSession', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSession"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionPath', () => { - const result = client.projectAgentEnvironmentUserSessionPath("projectValue", "environmentValue", "userValue", "sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSession', () => { - const fakePath = "/rendered/path/projectAgentSession"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionPath', () => { - const result = client.projectAgentSessionPath("projectValue", "sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionName', () => { - const result = client.matchProjectFromProjectAgentSessionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionName', () => { - const result = client.matchSessionFromProjectAgentSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new sessionsModule.v2.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.v2.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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSession', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSession"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSession', () => { - const fakePath = "/rendered/path/projectLocationAgentSession"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionPath', () => { - const result = client.projectLocationAgentSessionPath("projectValue", "locationValue", "sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new sessionsModule.v2.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.v2.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)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v2/test/gapic_versions_v2.ts b/owl-bot-staging/v2/test/gapic_versions_v2.ts deleted file mode 100644 index bbf5b6d5..00000000 --- a/owl-bot-staging/v2/test/gapic_versions_v2.ts +++ /dev/null @@ -1,2334 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as versionsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.VersionsClient', () => { - it('has servicePath', () => { - const servicePath = versionsModule.v2.VersionsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = versionsModule.v2.VersionsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = versionsModule.v2.VersionsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new versionsModule.v2.VersionsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new versionsModule.v2.VersionsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.versionsStub, undefined); - await client.initialize(); - assert(client.versionsStub); - }); - - it('has close method', () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getVersion', () => { - it('invokes getVersion without error', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()); - client.innerApiCalls.getVersion = stubSimpleCall(expectedResponse); - const [response] = await client.getVersion(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getVersion without error using callback', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()); - client.innerApiCalls.getVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getVersion( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getVersion with error', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.GetVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getVersion(request), expectedError); - assert((client.innerApiCalls.getVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createVersion', () => { - it('invokes createVersion without error', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateVersionRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()); - client.innerApiCalls.createVersion = stubSimpleCall(expectedResponse); - const [response] = await client.createVersion(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createVersion without error using callback', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateVersionRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()); - client.innerApiCalls.createVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createVersion( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createVersion with error', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.CreateVersionRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createVersion(request), expectedError); - assert((client.innerApiCalls.createVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateVersion', () => { - it('invokes updateVersion without error', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateVersionRequest()); - request.version = {}; - request.version.name = ''; - const expectedHeaderRequestParams = "version.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()); - client.innerApiCalls.updateVersion = stubSimpleCall(expectedResponse); - const [response] = await client.updateVersion(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateVersion without error using callback', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateVersionRequest()); - request.version = {}; - request.version.name = ''; - const expectedHeaderRequestParams = "version.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()); - client.innerApiCalls.updateVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateVersion( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateVersion with error', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.UpdateVersionRequest()); - request.version = {}; - request.version.name = ''; - const expectedHeaderRequestParams = "version.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateVersion(request), expectedError); - assert((client.innerApiCalls.updateVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteVersion', () => { - it('invokes deleteVersion without error', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteVersion = stubSimpleCall(expectedResponse); - const [response] = await client.deleteVersion(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteVersion without error using callback', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteVersion( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteVersion with error', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.DeleteVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteVersion(request), expectedError); - assert((client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listVersions', () => { - it('invokes listVersions without error', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), - ]; - client.innerApiCalls.listVersions = stubSimpleCall(expectedResponse); - const [response] = await client.listVersions(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listVersions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listVersions without error using callback', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), - ]; - client.innerApiCalls.listVersions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listVersions( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IVersion[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listVersions as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listVersions with error', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listVersions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listVersions(request), expectedError); - assert((client.innerApiCalls.listVersions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listVersionsStream without error', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), - ]; - client.descriptors.page.listVersions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.Version[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.Version) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listVersions, request)); - assert.strictEqual( - (client.descriptors.page.listVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listVersionsStream with error', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listVersions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.Version[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.Version) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listVersions, request)); - assert.strictEqual( - (client.descriptors.page.listVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listVersions without error', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), - ]; - client.descriptors.page.listVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2.IVersion[] = []; - const iterable = client.listVersionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listVersions with error', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2.ListVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listVersionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2.IVersion[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new versionsModule.v2.VersionsClient({ - 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 versionsModule.v2.VersionsClient({ - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new versionsModule.v2.VersionsClient({ - 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 versionsModule.v2.VersionsClient({ - 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/owl-bot-staging/v2/tsconfig.json b/owl-bot-staging/v2/tsconfig.json deleted file mode 100644 index c78f1c88..00000000 --- a/owl-bot-staging/v2/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/v2/webpack.config.js b/owl-bot-staging/v2/webpack.config.js deleted file mode 100644 index 0d2fc635..00000000 --- a/owl-bot-staging/v2/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'dialogflow', - filename: './dialogflow.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/owl-bot-staging/v2beta1/.eslintignore b/owl-bot-staging/v2beta1/.eslintignore deleted file mode 100644 index 521dc25a..00000000 --- a/owl-bot-staging/v2beta1/.eslintignore +++ /dev/null @@ -1,6 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ diff --git a/owl-bot-staging/v2beta1/.eslintrc.json b/owl-bot-staging/v2beta1/.eslintrc.json deleted file mode 100644 index 78215349..00000000 --- a/owl-bot-staging/v2beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v2beta1/.gitignore b/owl-bot-staging/v2beta1/.gitignore deleted file mode 100644 index 5d32b237..00000000 --- a/owl-bot-staging/v2beta1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/v2beta1/.jsdoc.js b/owl-bot-staging/v2beta1/.jsdoc.js deleted file mode 100644 index 01541b4a..00000000 --- a/owl-bot-staging/v2beta1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2021 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/dialogflow', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v2beta1/.mocharc.js b/owl-bot-staging/v2beta1/.mocharc.js deleted file mode 100644 index 50bc7f79..00000000 --- a/owl-bot-staging/v2beta1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v2beta1/.prettierrc.js b/owl-bot-staging/v2beta1/.prettierrc.js deleted file mode 100644 index 84f4713a..00000000 --- a/owl-bot-staging/v2beta1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v2beta1/README.md b/owl-bot-staging/v2beta1/README.md deleted file mode 100644 index f592662a..00000000 --- a/owl-bot-staging/v2beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Dialogflow: Nodejs Client diff --git a/owl-bot-staging/v2beta1/linkinator.config.json b/owl-bot-staging/v2beta1/linkinator.config.json deleted file mode 100644 index 29a223b6..00000000 --- a/owl-bot-staging/v2beta1/linkinator.config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io" - ], - "silent": true, - "concurrency": 10 -} diff --git a/owl-bot-staging/v2beta1/package.json b/owl-bot-staging/v2beta1/package.json deleted file mode 100644 index 050cef0d..00000000 --- a/owl-bot-staging/v2beta1/package.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "name": "@google-cloud/dialogflow", - "version": "0.1.0", - "description": "Dialogflow client for Node.js", - "repository": "googleapis/nodejs-dialogflow", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google dialogflow", - "dialogflow", - "agents", - "answer records", - "contexts", - "conversation profiles", - "conversations", - "documents", - "entity types", - "environments", - "fulfillments", - "intents", - "knowledge bases", - "participants", - "session entity types", - "sessions", - "versions" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^2.19.0" - }, - "devDependencies": { - "@types/mocha": "^9.0.0", - "@types/node": "^14.17.3", - "@types/sinon": "^10.0.2", - "c8": "^7.7.3", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.0", - "jsdoc-region-tag": "^1.1.0", - "linkinator": "^2.13.6", - "mocha": "^9.0.2", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^11.1.1", - "ts-loader": "^9.2.3", - "typescript": "^4.3.4", - "webpack": "^5.39.1", - "webpack-cli": "^4.7.2" - }, - "engines": { - "node": ">=v10.24.0" - } -} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/agent.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/agent.proto deleted file mode 100644 index 49c464e8..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/agent.proto +++ /dev/null @@ -1,519 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dialogflow/v2beta1/environment.proto"; -import "google/cloud/dialogflow/v2beta1/validation_result.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "AgentProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; - -// Service for managing [Agents][google.cloud.dialogflow.v2beta1.Agent]. -service Agents { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Retrieves the specified agent. - rpc GetAgent(GetAgentRequest) returns (Agent) { - option (google.api.http) = { - get: "/v2beta1/{parent=projects/*}/agent" - additional_bindings { - get: "/v2beta1/{parent=projects/*/locations/*}/agent" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Creates/updates the specified agent. - rpc SetAgent(SetAgentRequest) returns (Agent) { - option (google.api.http) = { - post: "/v2beta1/{agent.parent=projects/*}/agent" - body: "agent" - additional_bindings { - post: "/v2beta1/{agent.parent=projects/*/locations/*}/agent" - body: "agent" - } - }; - option (google.api.method_signature) = "agent"; - } - - // Deletes the specified agent. - rpc DeleteAgent(DeleteAgentRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2beta1/{parent=projects/*}/agent" - additional_bindings { - delete: "/v2beta1/{parent=projects/*/locations/*}/agent" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Returns the list of agents. - // Since there is at most one conversational agent per project, this method is - // useful primarily for listing all agents across projects the caller has - // access to. One can achieve that with a wildcard project collection id "-". - // Refer to [List - // Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). - rpc SearchAgents(SearchAgentsRequest) returns (SearchAgentsResponse) { - option (google.api.http) = { - get: "/v2beta1/{parent=projects/*}/agent:search" - additional_bindings { - get: "/v2beta1/{parent=projects/*/locations/*}/agent:search" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Trains the specified agent. - // - // - // Operation - rpc TrainAgent(TrainAgentRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*}/agent:train" - body: "*" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*}/agent:train" - body: "*" - } - }; - option (google.api.method_signature) = "parent"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Struct" - }; - } - - // Exports the specified agent to a ZIP file. - // - // - // Operation - rpc ExportAgent(ExportAgentRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*}/agent:export" - body: "*" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*}/agent:export" - body: "*" - } - }; - option (google.api.method_signature) = "parent"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.dialogflow.v2beta1.ExportAgentResponse" - metadata_type: "google.protobuf.Struct" - }; - } - - // Imports the specified agent from a ZIP file. - // - // Uploads new intents and entity types without deleting the existing ones. - // Intents and entity types with the same name are replaced with the new - // versions from [ImportAgentRequest][google.cloud.dialogflow.v2beta1.ImportAgentRequest]. After the import, the imported draft - // agent will be trained automatically (unless disabled in agent settings). - // However, once the import is done, training may not be completed yet. Please - // call [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it returns in order to train - // explicitly. - // - // - // Operation - // An operation which tracks when importing is complete. It only tracks - // when the draft agent is updated not when it is done training. - rpc ImportAgent(ImportAgentRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*}/agent:import" - body: "*" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*}/agent:import" - body: "*" - } - }; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Struct" - }; - } - - // Restores the specified agent from a ZIP file. - // - // Replaces the current agent version with a new one. All the intents and - // entity types in the older version are deleted. After the restore, the - // restored draft agent will be trained automatically (unless disabled in - // agent settings). However, once the restore is done, training may not be - // completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it - // returns in order to train explicitly. - // - // - // Operation - // An operation which tracks when restoring is complete. It only tracks - // when the draft agent is updated not when it is done training. - rpc RestoreAgent(RestoreAgentRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*}/agent:restore" - body: "*" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*}/agent:restore" - body: "*" - } - }; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Struct" - }; - } - - // Gets agent validation result. Agent validation is performed during - // training time and is updated automatically when training is completed. - rpc GetValidationResult(GetValidationResultRequest) returns (ValidationResult) { - option (google.api.http) = { - get: "/v2beta1/{parent=projects/*}/agent/validationResult" - additional_bindings { - get: "/v2beta1/{parent=projects/*/locations/*}/agent/validationResult" - } - }; - } -} - -// A Dialogflow agent is a virtual agent that handles conversations with your -// end-users. It is a natural language understanding module that understands the -// nuances of human language. Dialogflow translates end-user text or audio -// during a conversation to structured data that your apps and services can -// understand. You design and build a Dialogflow agent to handle the types of -// conversations required for your system. -// -// For more information about agents, see the -// [Agent guide](https://cloud.google.com/dialogflow/docs/agents-overview). -// -message Agent { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/Agent" - pattern: "projects/{project}/agent" - pattern: "projects/{project}/locations/{location}/agent" - }; - - // Match mode determines how intents are detected from user queries. - enum MatchMode { - // Not specified. - MATCH_MODE_UNSPECIFIED = 0; - - // Best for agents with a small number of examples in intents and/or wide - // use of templates syntax and composite entities. - MATCH_MODE_HYBRID = 1; - - // Can be used for agents with a large number of examples in intents, - // especially the ones using @sys.any or very large custom entities. - MATCH_MODE_ML_ONLY = 2; - } - - // API version for the agent. - enum ApiVersion { - // Not specified. - API_VERSION_UNSPECIFIED = 0; - - // Legacy V1 API. - API_VERSION_V1 = 1; - - // V2 API. - API_VERSION_V2 = 2; - - // V2beta1 API. - API_VERSION_V2_BETA_1 = 3; - } - - // Represents the agent tier. - enum Tier { - // Not specified. This value should never be used. - TIER_UNSPECIFIED = 0; - - // Standard tier. - TIER_STANDARD = 1; - - // Enterprise tier (Essentials). - TIER_ENTERPRISE = 2; - - // Enterprise tier (Plus). - TIER_ENTERPRISE_PLUS = 3; - } - - // Required. The project of this agent. - // Format: `projects/` or - // `projects//locations/` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Required. The name of this agent. - string display_name = 2; - - // Required. The default language of the agent as a language tag. See - // [Language - // Support](https://cloud.google.com/dialogflow/docs/reference/language) - // for a list of the currently supported language codes. This field cannot be - // set by the `Update` method. - string default_language_code = 3; - - // Optional. The list of all languages supported by this agent (except for the - // `default_language_code`). - repeated string supported_language_codes = 4; - - // Required. The time zone of this agent from the - // [time zone database](https://www.iana.org/time-zones), e.g., - // America/New_York, Europe/Paris. - string time_zone = 5; - - // Optional. The description of this agent. - // The maximum length is 500 characters. If exceeded, the request is rejected. - string description = 6; - - // Optional. The URI of the agent's avatar. - // Avatars are used throughout the Dialogflow console and in the self-hosted - // [Web - // Demo](https://cloud.google.com/dialogflow/docs/integrations/web-demo) - // integration. - string avatar_uri = 7; - - // Optional. Determines whether this agent should log conversation queries. - bool enable_logging = 8; - - // Optional. Determines how intents are detected from user queries. - MatchMode match_mode = 9 [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 - // learning classification threshold. If the returned score value is less than - // the threshold value, then a fallback intent will be triggered or, if there - // are no fallback intents defined, no intent will be triggered. The score - // values range from 0.0 (completely uncertain) to 1.0 (completely certain). - // If set to 0.0, the default of 0.3 is used. - float classification_threshold = 10; - - // Optional. API version displayed in Dialogflow console. If not specified, - // V2 API is assumed. Clients are free to query different service endpoints - // for different API versions. However, bots connectors and webhook calls will - // follow the specified API version. - ApiVersion api_version = 14; - - // Optional. The agent tier. If not specified, TIER_STANDARD is assumed. - Tier tier = 15; -} - -// The request message for [Agents.GetAgent][google.cloud.dialogflow.v2beta1.Agents.GetAgent]. -message GetAgentRequest { - // Required. The project that the agent to fetch is associated with. - // Format: `projects/` or - // `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Agent" - } - ]; -} - -// The request message for [Agents.SetAgent][google.cloud.dialogflow.v2beta1.Agents.SetAgent]. -message SetAgentRequest { - // Required. The agent to update. - Agent agent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 2; -} - -// The request message for [Agents.DeleteAgent][google.cloud.dialogflow.v2beta1.Agents.DeleteAgent]. -message DeleteAgentRequest { - // Required. The project that the agent to delete is associated with. - // Format: `projects/` or - // `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Agent" - } - ]; -} - -// Contains basic configuration for a sub-agent. -message SubAgent { - // Required. The project of this agent. - // Format: `projects/` or - // `projects//locations/`. - string project = 1; - - // Optional. The unique identifier (`environment name` in dialogflow console) - // of this sub-agent environment. Assumes draft environment if `environment` - // is not set. - string environment = 2; -} - -// The request message for [Agents.SearchAgents][google.cloud.dialogflow.v2beta1.Agents.SearchAgents]. -message SearchAgentsRequest { - // Required. The project to list agents from. - // Format: `projects/` or - // `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Agent" - } - ]; - - // Optional. The maximum number of items to return in a single page. By - // default 100 and at most 1000. - int32 page_size = 2; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 3; -} - -// The response message for [Agents.SearchAgents][google.cloud.dialogflow.v2beta1.Agents.SearchAgents]. -message SearchAgentsResponse { - // The list of agents. There will be a maximum number of items returned based - // on the page_size field in the request. - repeated Agent agents = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request message for [Agents.TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent]. -message TrainAgentRequest { - // Required. The project that the agent to train is associated with. - // Format: `projects/` or - // `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Agent" - } - ]; -} - -// The request message for [Agents.ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent]. -message ExportAgentRequest { - // Required. The project that the agent to export is associated with. - // Format: `projects/` or - // `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Agent" - } - ]; - - // Optional. The - // [Google Cloud Storage](https://cloud.google.com/storage/docs/) - // URI to export the agent to. - // The format of this URI must be `gs:///`. - // If left unspecified, the serialized agent is returned inline. - string agent_uri = 2; -} - -// The response message for [Agents.ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent]. -message ExportAgentResponse { - // The exported agent. - oneof agent { - // The URI to a file containing the exported agent. This field is populated - // only if `agent_uri` is specified in `ExportAgentRequest`. - string agent_uri = 1; - - // Zip compressed raw byte content for agent. - bytes agent_content = 2; - } -} - -// The request message for [Agents.ImportAgent][google.cloud.dialogflow.v2beta1.Agents.ImportAgent]. -message ImportAgentRequest { - // Required. The project that the agent to import is associated with. - // Format: `projects/` or - // `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Agent" - } - ]; - - // Required. The agent to import. - oneof agent { - // The URI to a Google Cloud Storage file containing the agent to import. - // Note: The URI must start with "gs://". - string agent_uri = 2; - - // Zip compressed raw byte content for agent. - bytes agent_content = 3; - } -} - -// The request message for [Agents.RestoreAgent][google.cloud.dialogflow.v2beta1.Agents.RestoreAgent]. -message RestoreAgentRequest { - // Required. The project that the agent to restore is associated with. - // Format: `projects/` or - // `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Agent" - } - ]; - - // Required. The agent to restore. - oneof agent { - // The URI to a Google Cloud Storage file containing the agent to restore. - // Note: The URI must start with "gs://". - string agent_uri = 2; - - // Zip compressed raw byte content for agent. - bytes agent_content = 3; - } -} - -// The request message for [Agents.GetValidationResult][google.cloud.dialogflow.v2beta1.Agents.GetValidationResult]. -message GetValidationResultRequest { - // Required. The project that the agent is associated with. - // Format: `projects/` or - // `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Agent" - } - ]; - - // Optional. The language for which you want a validation result. If not - // specified, the agent's default language is used. [Many - // languages](https://cloud.google.com/dialogflow/docs/reference/language) - // are supported. Note: languages must be enabled in the agent before they can - // be used. - string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/answer_record.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/answer_record.proto deleted file mode 100644 index fd7d5312..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/answer_record.proto +++ /dev/null @@ -1,317 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dialogflow/v2beta1/participant.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "AnswerRecordsProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; - -// Service for managing [AnswerRecords][google.cloud.dialogflow.v2beta1.AnswerRecord]. -service AnswerRecords { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Deprecated. - // Retrieves a specific answer record. - rpc GetAnswerRecord(GetAnswerRecordRequest) returns (AnswerRecord) { - option deprecated = true; - option (google.api.http) = { - get: "/v2beta1/{name=projects/*/answerRecords/*}" - additional_bindings { - get: "/v2beta1/{name=projects/*/locations/*/answerRecords/*}" - } - }; - } - - // Returns the list of all answer records in the specified project in reverse - // chronological order. - rpc ListAnswerRecords(ListAnswerRecordsRequest) returns (ListAnswerRecordsResponse) { - option (google.api.http) = { - get: "/v2beta1/{parent=projects/*}/answerRecords" - additional_bindings { - get: "/v2beta1/{parent=projects/*/locations/*}/answerRecords" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Updates the specified answer record. - rpc UpdateAnswerRecord(UpdateAnswerRecordRequest) returns (AnswerRecord) { - option (google.api.http) = { - patch: "/v2beta1/{answer_record.name=projects/*/answerRecords/*}" - body: "answer_record" - additional_bindings { - patch: "/v2beta1/{answer_record.name=projects/*/locations/*/answerRecords/*}" - body: "answer_record" - } - }; - option (google.api.method_signature) = "answer_record,update_mask"; - } -} - -// Answer records are records to manage answer history and feedbacks for -// Dialogflow. -// -// Currently, answer record includes: -// -// - human agent assistant article suggestion -// - human agent assistant faq article -// -// It doesn't include: -// -// - `DetectIntent` intent matching -// - `DetectIntent` knowledge -// -// Answer records are not related to the conversation history in the -// Dialogflow Console. A Record is generated even when the end-user disables -// conversation history in the console. Records are created when there's a human -// agent assistant suggestion generated. -// -// A typical workflow for customers provide feedback to an answer is: -// -// 1. For human agent assistant, customers get suggestion via ListSuggestions -// API. Together with the answers, [AnswerRecord.name][google.cloud.dialogflow.v2beta1.AnswerRecord.name] are returned to the -// customers. -// 2. The customer uses the [AnswerRecord.name][google.cloud.dialogflow.v2beta1.AnswerRecord.name] to call the -// [UpdateAnswerRecord][] method to send feedback about a specific answer -// that they believe is wrong. -message AnswerRecord { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/AnswerRecord" - pattern: "projects/{project}/answerRecords/{answer_record}" - pattern: "projects/{project}/locations/{location}/answerRecords/{answer_record}" - }; - - // The unique identifier of this answer record. - // Required for [AnswerRecords.UpdateAnswerRecord][google.cloud.dialogflow.v2beta1.AnswerRecords.UpdateAnswerRecord] method. - // Format: `projects//locations//answerRecords/`. - string name = 1; - - // Optional. The AnswerFeedback for this record. You can set this with - // [AnswerRecords.UpdateAnswerRecord][google.cloud.dialogflow.v2beta1.AnswerRecords.UpdateAnswerRecord] in order to give us feedback about - // this answer. - AnswerFeedback answer_feedback = 3; - - // Output only. The record for this answer. - oneof record { - // Output only. The record for human agent assistant. - AgentAssistantRecord agent_assistant_record = 4; - } -} - -// Represents a record of a human agent assistant answer. -message AgentAssistantRecord { - // Output only. The agent assistant answer. - oneof answer { - // Output only. The article suggestion answer. - ArticleAnswer article_suggestion_answer = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The FAQ answer. - FaqAnswer faq_answer = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - } -} - -// Represents feedback the customer has about the quality & correctness of a -// certain answer in a conversation. -message AnswerFeedback { - // The correctness level of an answer. - enum CorrectnessLevel { - // Correctness level unspecified. - CORRECTNESS_LEVEL_UNSPECIFIED = 0; - - // Answer is totally wrong. - NOT_CORRECT = 1; - - // Answer is partially correct. - PARTIALLY_CORRECT = 2; - - // Answer is fully correct. - FULLY_CORRECT = 3; - } - - // The correctness level of the specific answer. - CorrectnessLevel correctness_level = 1; - - // Normally, detail feedback is provided when answer is not fully correct. - oneof detail_feedback { - // Optional. Detail feedback of agent assistant suggestions. - AgentAssistantFeedback agent_assistant_detail_feedback = 2; - } - - // Indicates whether the answer/item was clicked by the human agent - // or not. Default to false. - bool clicked = 3; - - // Time when the answer/item was clicked. - google.protobuf.Timestamp click_time = 5; - - // Indicates whether the answer/item was displayed to the human - // agent in the agent desktop UI. Default to false. - bool displayed = 4; - - // Time when the answer/item was displayed. - google.protobuf.Timestamp display_time = 6; -} - -// Detail feedback of Agent Assistant result. -message AgentAssistantFeedback { - // Feedback for conversation summarization. - message SummarizationFeedback { - // Timestamp when composing of the summary starts. - google.protobuf.Timestamp start_timestamp = 1; - - // Timestamp when the summary was submitted. - google.protobuf.Timestamp submit_timestamp = 2; - - // Text of actual submitted summary. - string summary_text = 3; - } - - // Relevance of an answer. - enum AnswerRelevance { - // Answer relevance unspecified. - ANSWER_RELEVANCE_UNSPECIFIED = 0; - - // Answer is irrelevant to query. - IRRELEVANT = 1; - - // Answer is relevant to query. - RELEVANT = 2; - } - - // Correctness of document. - enum DocumentCorrectness { - // Document correctness unspecified. - DOCUMENT_CORRECTNESS_UNSPECIFIED = 0; - - // Information in document is incorrect. - INCORRECT = 1; - - // Information in document is correct. - CORRECT = 2; - } - - // Efficiency of document. - enum DocumentEfficiency { - // Document efficiency unspecified. - DOCUMENT_EFFICIENCY_UNSPECIFIED = 0; - - // Document is inefficient. - INEFFICIENT = 1; - - // Document is efficient. - EFFICIENT = 2; - } - - // Optional. Whether or not the suggested answer is relevant. - // - // For example: - // - // * Query: "Can I change my mailing address?" - // * Suggested document says: "Items must be returned/exchanged within 60 - // days of the purchase date." - // * [answer_relevance][google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.answer_relevance]: [AnswerRelevance.IRRELEVANT][google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.AnswerRelevance.IRRELEVANT] - AnswerRelevance answer_relevance = 1; - - // Optional. Whether or not the information in the document is correct. - // - // For example: - // - // * Query: "Can I return the package in 2 days once received?" - // * Suggested document says: "Items must be returned/exchanged within 60 - // days of the purchase date." - // * Ground truth: "No return or exchange is allowed." - // * [document_correctness]: INCORRECT - DocumentCorrectness document_correctness = 2; - - // Optional. Whether or not the suggested document is efficient. For example, - // if the document is poorly written, hard to understand, hard to use or - // too long to find useful information, [document_efficiency][google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.document_efficiency] is - // [DocumentEfficiency.INEFFICIENT][google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentEfficiency.INEFFICIENT]. - DocumentEfficiency document_efficiency = 3; - - // Feedback for conversation summarization. - SummarizationFeedback summarization_feedback = 4; -} - -// Request message for [AnswerRecords.GetAnswerRecord][google.cloud.dialogflow.v2beta1.AnswerRecords.GetAnswerRecord]. -message GetAnswerRecordRequest { - // Required. The name of the answer record to retrieve. - // Format: `projects//locations//answerRecords/`. - string name = 1; -} - -// Request message for [AnswerRecords.ListAnswerRecords][google.cloud.dialogflow.v2beta1.AnswerRecords.ListAnswerRecords]. -message ListAnswerRecordsRequest { - // Required. The project to list all answer records for in reverse - // chronological order. Format: `projects//locations/`. - string parent = 1 [(google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/AnswerRecord" - }]; - - // Optional. The maximum number of records to return in a single page. - // The server may return fewer records than this. If unspecified, we use 10. - // The maximum is 100. - int32 page_size = 3; - - // Optional. The - // [ListAnswerRecordsResponse.next_page_token][google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse.next_page_token] - // value returned from a previous list request used to continue listing on - // the next page. - string page_token = 4; -} - -// Response message for [AnswerRecords.ListAnswerRecords][google.cloud.dialogflow.v2beta1.AnswerRecords.ListAnswerRecords]. -message ListAnswerRecordsResponse { - // The list of answer records. - repeated AnswerRecord answer_records = 1; - - // A token to retrieve next page of results. Or empty if there are no more - // results. - // Pass this value in the - // [ListAnswerRecordsRequest.page_token][google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest.page_token] - // field in the subsequent call to `ListAnswerRecords` method to retrieve the - // next page of results. - string next_page_token = 2; -} - -// Request message for [AnswerRecords.UpdateAnswerRecord][google.cloud.dialogflow.v2beta1.AnswerRecords.UpdateAnswerRecord]. -message UpdateAnswerRecordRequest { - // Required. Answer record to update. - AnswerRecord answer_record = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 2; -} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/audio_config.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/audio_config.proto deleted file mode 100644 index 45b1c2b7..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/audio_config.proto +++ /dev/null @@ -1,437 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/field_mask.proto"; -import "google/api/annotations.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "AudioConfigProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; - -// Audio encoding of the audio content sent in the conversational query request. -// Refer to the -// [Cloud Speech API -// documentation](https://cloud.google.com/speech-to-text/docs/basics) for more -// details. -enum AudioEncoding { - // Not specified. - AUDIO_ENCODING_UNSPECIFIED = 0; - - // Uncompressed 16-bit signed little-endian samples (Linear PCM). - AUDIO_ENCODING_LINEAR_16 = 1; - - // [`FLAC`](https://xiph.org/flac/documentation.html) (Free Lossless Audio - // Codec) is the recommended encoding because it is lossless (therefore - // recognition is not compromised) and requires only about half the - // bandwidth of `LINEAR16`. `FLAC` stream encoding supports 16-bit and - // 24-bit samples, however, not all fields in `STREAMINFO` are supported. - AUDIO_ENCODING_FLAC = 2; - - // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. - AUDIO_ENCODING_MULAW = 3; - - // Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000. - AUDIO_ENCODING_AMR = 4; - - // Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000. - AUDIO_ENCODING_AMR_WB = 5; - - // Opus encoded audio frames in Ogg container - // ([OggOpus](https://wiki.xiph.org/OggOpus)). - // `sample_rate_hertz` must be 16000. - AUDIO_ENCODING_OGG_OPUS = 6; - - // Although the use of lossy encodings is not recommended, if a very low - // bitrate encoding is required, `OGG_OPUS` is highly preferred over - // Speex encoding. The [Speex](https://speex.org/) encoding supported by - // Dialogflow API has a header byte in each block, as in MIME type - // `audio/x-speex-with-header-byte`. - // It is a variant of the RTP Speex encoding defined in - // [RFC 5574](https://tools.ietf.org/html/rfc5574). - // The stream is a sequence of blocks, one block per RTP packet. Each block - // starts with a byte containing the length of the block, in bytes, followed - // by one or more frames of Speex data, padded to an integral number of - // bytes (octets) as specified in RFC 5574. In other words, each RTP header - // is replaced with a single byte containing the block length. Only Speex - // wideband is supported. `sample_rate_hertz` must be 16000. - AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7; -} - -// 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. - string word = 3; - - // Time offset relative to the beginning of the audio that corresponds to the - // start of the spoken word. This is an experimental feature and the accuracy - // of the time offset can vary. - google.protobuf.Duration start_offset = 1; - - // Time offset relative to the beginning of the audio that corresponds to the - // end of the spoken word. This is an experimental feature and the accuracy of - // the time offset can vary. - google.protobuf.Duration end_offset = 2; - - // The Speech confidence between 0.0 and 1.0 for this word. A higher number - // indicates an estimated greater likelihood that the recognized word is - // correct. The default of 0.0 is a sentinel value indicating that confidence - // was not set. - // - // This field is not guaranteed to be fully stable over time for the same - // audio input. Users should also not rely on it to always be provided. - float confidence = 4; -} - -// Variant of the specified [Speech model][google.cloud.dialogflow.v2beta1.InputAudioConfig.model] to use. -// -// See the [Cloud Speech -// documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) -// for which models have different variants. For example, the "phone_call" model -// has both a standard and an enhanced variant. When you use an enhanced model, -// you will generally receive higher quality results than for a standard model. -enum SpeechModelVariant { - // No model variant specified. In this case Dialogflow defaults to - // USE_BEST_AVAILABLE. - SPEECH_MODEL_VARIANT_UNSPECIFIED = 0; - - // Use the best available variant of the [Speech - // model][InputAudioConfig.model] that the caller is eligible for. - // - // Please see the [Dialogflow - // docs](https://cloud.google.com/dialogflow/docs/data-logging) for - // how to make your project eligible for enhanced models. - USE_BEST_AVAILABLE = 1; - - // Use standard model variant even if an enhanced model is available. See the - // [Cloud Speech - // documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) - // for details about enhanced models. - USE_STANDARD = 2; - - // Use an enhanced model variant: - // - // * If an enhanced variant does not exist for the given - // [model][google.cloud.dialogflow.v2beta1.InputAudioConfig.model] and request language, Dialogflow falls - // back to the standard variant. - // - // The [Cloud Speech - // documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) - // describes which models have enhanced variants. - // - // * If the API caller isn't eligible for enhanced models, Dialogflow returns - // an error. Please see the [Dialogflow - // docs](https://cloud.google.com/dialogflow/docs/data-logging) - // for how to make your project eligible. - USE_ENHANCED = 3; -} - -// Instructs the speech recognizer on how to process the audio content. -message InputAudioConfig { - // Required. Audio encoding of the audio content to process. - AudioEncoding audio_encoding = 1; - - // Required. Sample rate (in Hertz) of the audio content sent in the query. - // Refer to - // [Cloud Speech API - // documentation](https://cloud.google.com/speech-to-text/docs/basics) for - // more details. - int32 sample_rate_hertz = 2; - - // Required. The language of the supplied audio. Dialogflow does not do - // translations. See [Language - // Support](https://cloud.google.com/dialogflow/docs/reference/language) - // for a list of the currently supported language codes. Note that queries in - // the same session do not necessarily need to specify the same language. - string language_code = 3; - - // If `true`, Dialogflow returns [SpeechWordInfo][google.cloud.dialogflow.v2beta1.SpeechWordInfo] in - // [StreamingRecognitionResult][google.cloud.dialogflow.v2beta1.StreamingRecognitionResult] with information about the recognized speech - // words, e.g. start and end time offsets. If false or unspecified, Speech - // doesn't return any word-level information. - bool enable_word_info = 13; - - // A list of strings containing words and phrases that the speech - // recognizer should recognize with higher likelihood. - // - // See [the Cloud Speech - // documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) - // for more details. - // - // This field is deprecated. Please use [speech_contexts]() instead. If you - // specify both [phrase_hints]() and [speech_contexts](), Dialogflow will - // treat the [phrase_hints]() as a single additional [SpeechContext](). - repeated string phrase_hints = 4 [deprecated = true]; - - // Context information to assist speech recognition. - // - // See [the Cloud Speech - // documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) - // for more details. - repeated SpeechContext speech_contexts = 11; - - // Which Speech model to select for the given request. Select the - // model best suited to your domain to get best results. If a model is not - // explicitly specified, then we auto-select a model based on the parameters - // in the InputAudioConfig. - // If enhanced speech model is enabled for the agent and an enhanced - // version of the specified model for the language does not exist, then the - // speech is recognized using the standard version of the specified model. - // Refer to - // [Cloud Speech API - // documentation](https://cloud.google.com/speech-to-text/docs/basics#select-model) - // for more details. - string model = 7; - - // Which variant of the [Speech model][google.cloud.dialogflow.v2beta1.InputAudioConfig.model] to use. - SpeechModelVariant model_variant = 10; - - // If `false` (default), recognition does not cease until the - // client closes the stream. - // If `true`, the recognizer will detect a single spoken utterance in input - // audio. Recognition ceases when it detects the audio's voice has - // stopped or paused. In this case, once a detected intent is received, the - // client should close the stream and start a new request with a new stream as - // needed. - // Note: This setting is relevant only for streaming methods. - // Note: When specified, InputAudioConfig.single_utterance takes precedence - // over StreamingDetectIntentRequest.single_utterance. - bool single_utterance = 8; - - // Only used in [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] and - // [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent]. - // If `false` and recognition doesn't return any result, trigger - // `NO_SPEECH_RECOGNIZED` event to Dialogflow agent. - bool disable_no_speech_recognized_event = 14; -} - -// Description of which voice to use for speech synthesis. -message VoiceSelectionParams { - // Optional. The name of the voice. If not set, the service will choose a - // voice based on the other parameters such as language_code and - // [ssml_gender][google.cloud.dialogflow.v2beta1.VoiceSelectionParams.ssml_gender]. - // - // For the list of available voices, please refer to [Supported voices and - // languages](https://cloud.google.com/text-to-speech/docs/voices). - string name = 1; - - // Optional. The preferred gender of the voice. If not set, the service will - // choose a voice based on the other parameters such as language_code and - // [name][google.cloud.dialogflow.v2beta1.VoiceSelectionParams.name]. Note that this is only a preference, not requirement. If a - // voice of the appropriate gender is not available, the synthesizer should - // substitute a voice with a different gender rather than failing the request. - SsmlVoiceGender ssml_gender = 2; -} - -// Configuration of how speech should be synthesized. -message SynthesizeSpeechConfig { - // Optional. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is the normal - // native speed supported by the specific voice. 2.0 is twice as fast, and - // 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any - // other values < 0.25 or > 4.0 will return an error. - double speaking_rate = 1; - - // Optional. Speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20 - // semitones from the original pitch. -20 means decrease 20 semitones from the - // original pitch. - double pitch = 2; - - // Optional. Volume gain (in dB) of the normal native volume supported by the - // specific voice, in the range [-96.0, 16.0]. If unset, or set to a value of - // 0.0 (dB), will play at normal native signal amplitude. A value of -6.0 (dB) - // will play at approximately half the amplitude of the normal native signal - // amplitude. A value of +6.0 (dB) will play at approximately twice the - // amplitude of the normal native signal amplitude. We strongly recommend not - // to exceed +10 (dB) as there's usually no effective increase in loudness for - // any value greater than that. - double volume_gain_db = 3; - - // Optional. An identifier which selects 'audio effects' profiles that are - // applied on (post synthesized) text to speech. Effects are applied on top of - // each other in the order they are given. - repeated string effects_profile_id = 5; - - // Optional. The desired voice of the synthesized audio. - VoiceSelectionParams voice = 4; -} - -// Gender of the voice as described in -// [SSML voice element](https://www.w3.org/TR/speech-synthesis11/#edef_voice). -enum SsmlVoiceGender { - // An unspecified gender, which means that the client doesn't care which - // gender the selected voice will have. - SSML_VOICE_GENDER_UNSPECIFIED = 0; - - // A male voice. - SSML_VOICE_GENDER_MALE = 1; - - // A female voice. - SSML_VOICE_GENDER_FEMALE = 2; - - // A gender-neutral voice. - SSML_VOICE_GENDER_NEUTRAL = 3; -} - -// Instructs the speech synthesizer how to generate the output audio content. -// If this audio config is supplied in a request, it overrides all existing -// text-to-speech settings applied to the agent. -message OutputAudioConfig { - // Required. Audio encoding of the synthesized audio content. - OutputAudioEncoding audio_encoding = 1 [(google.api.field_behavior) = REQUIRED]; - - // The synthesis sample rate (in hertz) for this audio. If not - // provided, then the synthesizer will use the default sample rate based on - // the audio encoding. If this is different from the voice's natural sample - // rate, then the synthesizer will honor this request by converting to the - // desired sample rate (which might result in worse audio quality). - int32 sample_rate_hertz = 2; - - // Configuration of how speech should be synthesized. - SynthesizeSpeechConfig synthesize_speech_config = 3; -} - -// A wrapper of repeated TelephonyDtmf digits. -message TelephonyDtmfEvents { - // A sequence of TelephonyDtmf digits. - repeated TelephonyDtmf dtmf_events = 1; -} - -// Audio encoding of the output audio format in Text-To-Speech. -enum OutputAudioEncoding { - // Not specified. - OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0; - - // Uncompressed 16-bit signed little-endian samples (Linear PCM). - // Audio content returned as LINEAR16 also contains a WAV header. - OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1; - - // MP3 audio at 32kbps. - OUTPUT_AUDIO_ENCODING_MP3 = 2; - - // MP3 audio at 64kbps. - OUTPUT_AUDIO_ENCODING_MP3_64_KBPS = 4; - - // Opus encoded audio wrapped in an ogg container. The result will be a - // file which can be played natively on Android, and in browsers (at least - // Chrome and Firefox). The quality of the encoding is considerably higher - // than MP3 while using approximately the same bitrate. - OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3; - - // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. - OUTPUT_AUDIO_ENCODING_MULAW = 5; -} - -// Configures speech transcription for [ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile]. -message SpeechToTextConfig { - // Optional. The speech model used in speech to text. - // `SPEECH_MODEL_VARIANT_UNSPECIFIED`, `USE_BEST_AVAILABLE` will be treated as - // `USE_ENHANCED`. It can be overridden in [AnalyzeContentRequest][google.cloud.dialogflow.v2beta1.AnalyzeContentRequest] and - // [StreamingAnalyzeContentRequest][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest] request. - SpeechModelVariant speech_model_variant = 1 [(google.api.field_behavior) = OPTIONAL]; -} - -// [DTMF](https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling) -// digit in Telephony Gateway. -enum TelephonyDtmf { - // Not specified. This value may be used to indicate an absent digit. - TELEPHONY_DTMF_UNSPECIFIED = 0; - - // Number: '1'. - DTMF_ONE = 1; - - // Number: '2'. - DTMF_TWO = 2; - - // Number: '3'. - DTMF_THREE = 3; - - // Number: '4'. - DTMF_FOUR = 4; - - // Number: '5'. - DTMF_FIVE = 5; - - // Number: '6'. - DTMF_SIX = 6; - - // Number: '7'. - DTMF_SEVEN = 7; - - // Number: '8'. - DTMF_EIGHT = 8; - - // Number: '9'. - DTMF_NINE = 9; - - // Number: '0'. - DTMF_ZERO = 10; - - // Letter: 'A'. - DTMF_A = 11; - - // Letter: 'B'. - DTMF_B = 12; - - // Letter: 'C'. - DTMF_C = 13; - - // Letter: 'D'. - DTMF_D = 14; - - // Asterisk/star: '*'. - DTMF_STAR = 15; - - // Pound/diamond/hash/square/gate/octothorpe: '#'. - DTMF_POUND = 16; -} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/context.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/context.proto deleted file mode 100644 index c18e411a..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/context.proto +++ /dev/null @@ -1,375 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "ContextProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; - -// Service for managing [Contexts][google.cloud.dialogflow.v2beta1.Context]. -service Contexts { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Returns the list of all contexts in the specified session. - rpc ListContexts(ListContextsRequest) returns (ListContextsResponse) { - option (google.api.http) = { - get: "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts" - additional_bindings { - get: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" - } - additional_bindings { - get: "/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/contexts" - } - additional_bindings { - get: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves the specified context. - rpc GetContext(GetContextRequest) returns (Context) { - option (google.api.http) = { - get: "/v2beta1/{name=projects/*/agent/sessions/*/contexts/*}" - additional_bindings { - get: "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" - } - additional_bindings { - get: "/v2beta1/{name=projects/*/locations/*/agent/sessions/*/contexts/*}" - } - additional_bindings { - get: "/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a context. - // - // If the specified context already exists, overrides the context. - rpc CreateContext(CreateContextRequest) returns (Context) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts" - body: "context" - additional_bindings { - post: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" - body: "context" - } - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/contexts" - body: "context" - } - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" - body: "context" - } - }; - option (google.api.method_signature) = "parent,context"; - } - - // Updates the specified context. - rpc UpdateContext(UpdateContextRequest) returns (Context) { - option (google.api.http) = { - patch: "/v2beta1/{context.name=projects/*/agent/sessions/*/contexts/*}" - body: "context" - additional_bindings { - patch: "/v2beta1/{context.name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" - body: "context" - } - additional_bindings { - patch: "/v2beta1/{context.name=projects/*/locations/*/agent/sessions/*/contexts/*}" - body: "context" - } - additional_bindings { - patch: "/v2beta1/{context.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" - body: "context" - } - }; - option (google.api.method_signature) = "context,update_mask"; - option (google.api.method_signature) = "context"; - } - - // Deletes the specified context. - rpc DeleteContext(DeleteContextRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2beta1/{name=projects/*/agent/sessions/*/contexts/*}" - additional_bindings { - delete: "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" - } - additional_bindings { - delete: "/v2beta1/{name=projects/*/locations/*/agent/sessions/*/contexts/*}" - } - additional_bindings { - delete: "/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Deletes all active contexts in the specified session. - rpc DeleteAllContexts(DeleteAllContextsRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts" - additional_bindings { - delete: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" - } - additional_bindings { - delete: "/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/contexts" - } - additional_bindings { - delete: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" - } - }; - option (google.api.method_signature) = "parent"; - } -} - -// Dialogflow contexts are similar to natural language context. If a person says -// to you "they are orange", you need context in order to understand what "they" -// is referring to. Similarly, for Dialogflow to handle an end-user expression -// like that, it needs to be provided with context in order to correctly match -// an intent. -// -// Using contexts, you can control the flow of a conversation. You can configure -// contexts for an intent by setting input and output contexts, which are -// identified by string names. When an intent is matched, any configured output -// contexts for that intent become active. While any contexts are active, -// Dialogflow is more likely to match intents that are configured with input -// contexts that correspond to the currently active contexts. -// -// For more information about context, see the -// [Contexts guide](https://cloud.google.com/dialogflow/docs/contexts-overview). -message Context { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/Context" - pattern: "projects/{project}/agent/sessions/{session}/contexts/{context}" - pattern: "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}" - pattern: "projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}" - pattern: "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}" - }; - - // Required. The unique identifier of the context. Supported formats: - // - `projects//agent/sessions//contexts/`, - // - `projects//locations//agent/sessions//contexts/`, - // - `projects//agent/environments//users//sessions//contexts/`, - // - `projects//locations//agent/environments//users//sessions//contexts/`, - // - // The `Context ID` is always converted to lowercase, may only contain - // characters in a-zA-Z0-9_-% and may be at most 250 bytes long. - // - // If `Environment ID` is not specified, we assume default 'draft' - // environment. If `User ID` is not specified, we assume default '-' user. - // - // The following context names are reserved for internal use by Dialogflow. - // You should not use these contexts or create contexts with these names: - // - // * `__system_counters__` - // * `*_id_dialog_context` - // * `*_dialog_params_size` - string name = 1; - - // Optional. The number of conversational query requests after which the - // context expires. The default is `0`. If set to `0`, the context expires - // immediately. Contexts expire automatically after 20 minutes if there - // are no matching queries. - int32 lifespan_count = 2; - - // Optional. The collection of parameters associated with this context. - // - // Depending on your protocol or client library language, this is a - // map, associative array, symbol table, dictionary, or JSON object - // composed of a collection of (MapKey, MapValue) pairs: - // - // - MapKey type: string - // - MapKey value: parameter name - // - MapValue type: - // - If parameter's entity type is a composite entity: map - // - Else: depending on parameter value type, could be one of string, - // number, boolean, null, list or map - // - MapValue value: - // - If parameter's entity type is a composite entity: - // map from composite entity property names to property values - // - Else: parameter value - google.protobuf.Struct parameters = 3; -} - -// The request message for [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts]. -message ListContextsRequest { - // Required. The session to list all contexts from. Supported formats: - // - `projects//agent/sessions/, - // - `projects//locations//agent/sessions/`, - // - `projects//agent/environments//users//sessions/`, - // - `projects//locations//agent/environments//users//sessions/`, - // - // If `Location ID` is not specified we assume default 'us' location. If - // `Environment ID` is not specified, we assume default 'draft' environment. - // If `User ID` is not specified, we assume default '-' user. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Context" - } - ]; - - // Optional. The maximum number of items to return in a single page. By - // default 100 and at most 1000. - int32 page_size = 2; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 3; -} - -// The response message for [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts]. -message ListContextsResponse { - // The list of contexts. There will be a maximum number of items - // returned based on the page_size field in the request. - repeated Context contexts = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request message for [Contexts.GetContext][google.cloud.dialogflow.v2beta1.Contexts.GetContext]. -message GetContextRequest { - // Required. The name of the context. Supported formats: - // - `projects//agent/sessions//contexts/`, - // - `projects//locations//agent/sessions//contexts/`, - // - `projects//agent/environments//users//sessions//contexts/`, - // - `projects//locations//agent/environments//users//sessions//contexts/`, - // - // If `Location ID` is not specified we assume default 'us' location. If - // `Environment ID` is not specified, we assume default 'draft' environment. - // If `User ID` is not specified, we assume default '-' user. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Context" - } - ]; -} - -// The request message for [Contexts.CreateContext][google.cloud.dialogflow.v2beta1.Contexts.CreateContext]. -message CreateContextRequest { - // Required. The session to create a context for. Supported formats: - // - `projects//agent/sessions/, - // - `projects//locations//agent/sessions/`, - // - `projects//agent/environments//users//sessions/`, - // - `projects//locations//agent/environments//users//sessions/`, - // - // If `Location ID` is not specified we assume default 'us' location. If - // `Environment ID` is not specified, we assume default 'draft' environment. - // If `User ID` is not specified, we assume default '-' user. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Context" - } - ]; - - // Required. The context to create. - Context context = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [Contexts.UpdateContext][google.cloud.dialogflow.v2beta1.Contexts.UpdateContext]. -message UpdateContextRequest { - // Required. The context to update. - Context context = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [Contexts.DeleteContext][google.cloud.dialogflow.v2beta1.Contexts.DeleteContext]. -message DeleteContextRequest { - // Required. The name of the context to delete. Supported formats: - // - `projects//agent/sessions//contexts/`, - // - `projects//locations//agent/sessions//contexts/`, - // - `projects//agent/environments//users//sessions//contexts/`, - // - `projects//locations//agent/environments//users//sessions//contexts/`, - // - // If `Location ID` is not specified we assume default 'us' location. If - // `Environment ID` is not specified, we assume default 'draft' environment. - // If `User ID` is not specified, we assume default '-' user. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Context" - } - ]; -} - -// The request message for [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContexts]. -message DeleteAllContextsRequest { - // Required. The name of the session to delete all contexts from. Supported formats: - // - `projects//agent/sessions/, - // - `projects//locations//agent/sessions/`, - // - `projects//agent/environments//users//sessions/`, - // - `projects//locations//agent/environments//users//sessions/`, - // - // If `Location ID` is not specified we assume default 'us' location. If - // `Environment ID` is not specified we assume default 'draft' environment. If - // `User ID` is not specified, we assume default '-' user. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Context" - } - ]; -} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation.proto deleted file mode 100644 index 6c2fdf6d..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation.proto +++ /dev/null @@ -1,419 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dialogflow/v2beta1/gcs.proto"; -import "google/cloud/dialogflow/v2beta1/participant.proto"; -import "google/cloud/dialogflow/v2beta1/session.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "ConversationProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; - -// Service for managing [Conversations][google.cloud.dialogflow.v2beta1.Conversation]. -service Conversations { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Creates a new conversation. Conversations are auto-completed after 24 - // hours. - // - // Conversation Lifecycle: - // There are two stages during a conversation: Automated Agent Stage and - // Assist Stage. - // - // For Automated Agent Stage, there will be a dialogflow agent responding to - // user queries. - // - // For Assist Stage, there's no dialogflow agent responding to user queries. - // But we will provide suggestions which are generated from conversation. - // - // If [Conversation.conversation_profile][google.cloud.dialogflow.v2beta1.Conversation.conversation_profile] is configured for a dialogflow - // agent, conversation will start from `Automated Agent Stage`, otherwise, it - // will start from `Assist Stage`. And during `Automated Agent Stage`, once an - // [Intent][google.cloud.dialogflow.v2beta1.Intent] with [Intent.live_agent_handoff][google.cloud.dialogflow.v2beta1.Intent.live_agent_handoff] is triggered, conversation - // will transfer to Assist Stage. - rpc CreateConversation(CreateConversationRequest) returns (Conversation) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*}/conversations" - body: "conversation" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*}/conversations" - body: "conversation" - } - }; - option (google.api.method_signature) = "parent,conversation"; - } - - // Returns the list of all conversations in the specified project. - rpc ListConversations(ListConversationsRequest) returns (ListConversationsResponse) { - option (google.api.http) = { - get: "/v2beta1/{parent=projects/*}/conversations" - additional_bindings { - get: "/v2beta1/{parent=projects/*/locations/*}/conversations" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves the specific conversation. - rpc GetConversation(GetConversationRequest) returns (Conversation) { - option (google.api.http) = { - get: "/v2beta1/{name=projects/*/conversations/*}" - additional_bindings { - get: "/v2beta1/{name=projects/*/locations/*/conversations/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Completes the specified conversation. Finished conversations are purged - // from the database after 30 days. - rpc CompleteConversation(CompleteConversationRequest) returns (Conversation) { - option (google.api.http) = { - post: "/v2beta1/{name=projects/*/conversations/*}:complete" - body: "*" - additional_bindings { - post: "/v2beta1/{name=projects/*/locations/*/conversations/*}:complete" - body: "*" - } - }; - option (google.api.method_signature) = "name"; - } - - // Batch ingests messages to conversation. Customers can use this RPC to - // ingest historical messages to conversation. - rpc BatchCreateMessages(BatchCreateMessagesRequest) returns (BatchCreateMessagesResponse) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*/conversations/*}/messages:batchCreate" - body: "*" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/conversations/*}/messages:batchCreate" - body: "*" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Lists messages that belong to a given conversation. - // `messages` are ordered by `create_time` in descending order. To fetch - // updates without duplication, send request with filter - // `create_time_epoch_microseconds > - // [first item's create_time of previous request]` and empty page_token. - rpc ListMessages(ListMessagesRequest) returns (ListMessagesResponse) { - option (google.api.http) = { - get: "/v2beta1/{parent=projects/*/conversations/*}/messages" - additional_bindings { - get: "/v2beta1/{parent=projects/*/locations/*/conversations/*}/messages" - } - }; - option (google.api.method_signature) = "parent"; - } -} - -// Represents a conversation. -// A conversation is an interaction between an agent, including live agents -// and Dialogflow agents, and a support customer. Conversations can -// include phone calls and text-based chat sessions. -message Conversation { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/Conversation" - pattern: "projects/{project}/conversations/{conversation}" - pattern: "projects/{project}/locations/{location}/conversations/{conversation}" - }; - - // Enumeration of the completion status of the conversation. - enum LifecycleState { - // Unknown. - LIFECYCLE_STATE_UNSPECIFIED = 0; - - // Conversation is currently open for media analysis. - IN_PROGRESS = 1; - - // Conversation has been completed. - COMPLETED = 2; - } - - // Enumeration of the different conversation stages a conversation can be in. - // Reference: - // https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages - enum ConversationStage { - // Unknown. Should never be used after a conversation is successfully - // created. - CONVERSATION_STAGE_UNSPECIFIED = 0; - - // The conversation should return virtual agent responses into the - // conversation. - VIRTUAL_AGENT_STAGE = 1; - - // The conversation should not provide responses, just listen and provide - // suggestions. - HUMAN_ASSIST_STAGE = 2; - } - - // Output only. The unique identifier of this conversation. - // Format: `projects//locations//conversations/`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the Conversation. - LifecycleState lifecycle_state = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. The Conversation Profile to be used to configure this - // Conversation. This field cannot be updated. - // Format: `projects//locations//conversationProfiles/`. - string conversation_profile = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/ConversationProfile" - } - ]; - - // Output only. Required if the conversation is to be connected over - // telephony. - ConversationPhoneNumber phone_number = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The stage of a conversation. It indicates whether the virtual agent or a - // human agent is handling the conversation. - // - // If the conversation is created with the conversation profile that has - // Dialogflow config set, defaults to - // [ConversationStage.VIRTUAL_AGENT_STAGE][google.cloud.dialogflow.v2beta1.Conversation.ConversationStage.VIRTUAL_AGENT_STAGE]; Otherwise, defaults to - // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2beta1.Conversation.ConversationStage.HUMAN_ASSIST_STAGE]. - // - // If the conversation is created with the conversation profile that has - // Dialogflow config set but explicitly sets conversation_stage to - // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2beta1.Conversation.ConversationStage.HUMAN_ASSIST_STAGE], it skips - // [ConversationStage.VIRTUAL_AGENT_STAGE][google.cloud.dialogflow.v2beta1.Conversation.ConversationStage.VIRTUAL_AGENT_STAGE] stage and directly goes to - // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2beta1.Conversation.ConversationStage.HUMAN_ASSIST_STAGE]. - ConversationStage conversation_stage = 7; - - // Output only. The time the conversation was started. - google.protobuf.Timestamp start_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the conversation was finished. - google.protobuf.Timestamp end_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents a phone number for telephony integration. It allows for connecting -// a particular conversation over telephony. -message ConversationPhoneNumber { - // Output only. The phone number to connect to this conversation. - string phone_number = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The request message for [Conversations.CreateConversation][google.cloud.dialogflow.v2beta1.Conversations.CreateConversation]. -message CreateConversationRequest { - // Required. Resource identifier of the project creating the conversation. - // Format: `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Conversation" - } - ]; - - // Required. The conversation to create. - Conversation conversation = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Identifier of the conversation. Generally it's auto generated by Google. - // Only set it if you cannot wait for the response to return a - // auto-generated one to you. - // - // The conversation ID must be compliant with the regression fomula - // "[a-zA-Z][a-zA-Z0-9_-]*" with the characters length in range of [3,64]. - // If the field is provided, the caller is resposible for - // 1. the uniqueness of the ID, otherwise the request will be rejected. - // 2. the consistency for whether to use custom ID or not under a project to - // better ensure uniqueness. - string conversation_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [Conversations.ListConversations][google.cloud.dialogflow.v2beta1.Conversations.ListConversations]. -message ListConversationsRequest { - // Required. The project from which to list all conversation. - // Format: `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Conversation" - } - ]; - - // Optional. The maximum number of items to return in a single page. By - // default 100 and at most 1000. - int32 page_size = 2; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 3; - - // A filter expression that filters conversations listed in the response. In - // general, the expression must specify the field name, a comparison operator, - // and the value to use for filtering: - //
    - //
  • The value must be a string, a number, or a boolean.
  • - //
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • - //
  • To filter on multiple expressions, separate the - // expressions with `AND` or `OR` (omitting both implies `AND`).
  • - //
  • For clarity, expressions can be enclosed in parentheses.
  • - //
- // Only `lifecycle_state` can be filtered on in this way. For example, - // the following expression only returns `COMPLETED` conversations: - // - // `lifecycle_state = "COMPLETED"` - // - // For more information about filtering, see - // [API Filtering](https://aip.dev/160). - string filter = 4; -} - -// The response message for [Conversations.ListConversations][google.cloud.dialogflow.v2beta1.Conversations.ListConversations]. -message ListConversationsResponse { - // The list of conversations. There will be a maximum number of items - // returned based on the page_size field in the request. - repeated Conversation conversations = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request message for [Conversations.GetConversation][google.cloud.dialogflow.v2beta1.Conversations.GetConversation]. -message GetConversationRequest { - // Required. The name of the conversation. Format: - // `projects//locations//conversations/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Conversation" - } - ]; -} - -// The request message for [Conversations.CompleteConversation][google.cloud.dialogflow.v2beta1.Conversations.CompleteConversation]. -message CompleteConversationRequest { - // Required. Resource identifier of the conversation to close. - // Format: `projects//locations//conversations/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Conversation" - } - ]; -} - -// The request message to create one Message. Currently it is only used in -// BatchCreateMessagesRequest. -message CreateMessageRequest { - // Required. Resource identifier of the conversation to create message. - // Format: `projects//locations//conversations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Conversation" - } - ]; - - // Required. The message to create. - // [Message.participant][google.cloud.dialogflow.v2beta1.Message.participant] is required. - Message message = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [Conversations.BatchCreateMessagesRequest][]. -message BatchCreateMessagesRequest { - // Required. Resource identifier of the conversation to create message. - // Format: `projects//locations//conversations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Conversation" - } - ]; - - // Required. A maximum of 1000 Messages can be created in a batch. - // [CreateMessageRequest.message.send_time][] is required. All created - // messages will have identical [Message.create_time][google.cloud.dialogflow.v2beta1.Message.create_time]. - repeated CreateMessageRequest requests = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [Conversations.BatchCreateMessagesResponse][]. -message BatchCreateMessagesResponse { - // Messages created. - repeated Message messages = 1; -} - -// The request message for [Conversations.ListMessages][google.cloud.dialogflow.v2beta1.Conversations.ListMessages]. -message ListMessagesRequest { - // Required. The name of the conversation to list messages for. - // Format: `projects//locations//conversations/` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Message" - } - ]; - - // Optional. Filter on message fields. Currently predicates on `create_time` - // and `create_time_epoch_microseconds` are supported. `create_time` only - // support milliseconds accuracy. E.g., - // `create_time_epoch_microseconds > 1551790877964485` or - // `create_time > "2017-01-15T01:30:15.01Z"`. - // - // For more information about filtering, see - // [API Filtering](https://aip.dev/160). - string filter = 4; - - // Optional. The maximum number of items to return in a single page. By - // default 100 and at most 1000. - int32 page_size = 2; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 3; -} - -// The response message for [Conversations.ListMessages][google.cloud.dialogflow.v2beta1.Conversations.ListMessages]. -message ListMessagesResponse { - // Required. The list of messages. There will be a maximum number of items - // returned based on the page_size field in the request. - // `messages` is sorted by `create_time` in descending order. - repeated Message messages = 1; - - // Optional. Token to retrieve the next page of results, or empty if there are - // no more results in the list. - string next_page_token = 2; -} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_event.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_event.proto deleted file mode 100644 index 35c1de1e..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_event.proto +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/cloud/dialogflow/v2beta1/participant.proto"; -import "google/rpc/status.proto"; -import "google/api/annotations.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "ConversationEventProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; - -// Represents a notification sent to Pub/Sub subscribers for conversation -// lifecycle events. -message ConversationEvent { - // Enumeration of the types of events available. - enum Type { - // Type not set. - TYPE_UNSPECIFIED = 0; - - // A new conversation has been opened. This is fired when a telephone call - // is answered, or a conversation is created via the API. - CONVERSATION_STARTED = 1; - - // An existing conversation has closed. This is fired when a telephone call - // is terminated, or a conversation is closed via the API. - CONVERSATION_FINISHED = 2; - - // An existing conversation has received a new message, either from API or - // telephony. It is configured in - // [ConversationProfile.new_message_event_notification_config][google.cloud.dialogflow.v2beta1.ConversationProfile.new_message_event_notification_config] - NEW_MESSAGE = 5; - - // Unrecoverable error during a telephone call. - // - // In general non-recoverable errors only occur if something was - // misconfigured in the ConversationProfile corresponding to the call. After - // a non-recoverable error, Dialogflow may stop responding. - // - // We don't fire this event: - // - // * in an API call because we can directly return the error, or, - // * when we can recover from an error. - UNRECOVERABLE_ERROR = 4; - } - - // Required. The unique identifier of the conversation this notification - // refers to. - // Format: `projects//conversations/`. - string conversation = 1; - - // Required. The type of the event that this notification refers to. - Type type = 2; - - // Optional. More detailed information about an error. Only set for type - // UNRECOVERABLE_ERROR_IN_PHONE_CALL. - google.rpc.Status error_status = 3; - - // Payload of conversation event. - oneof payload { - // Payload of NEW_MESSAGE event. - Message new_message_payload = 4; - } -} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto deleted file mode 100644 index c08509e5..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto +++ /dev/null @@ -1,581 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dialogflow/v2beta1/audio_config.proto"; -import "google/cloud/dialogflow/v2beta1/document.proto"; -import "google/cloud/dialogflow/v2beta1/participant.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "ConversationProfileProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; -option (google.api.resource_definition) = { - type: "dialogflow.googleapis.com/CXSecuritySettings" - pattern: "projects/{project}/locations/{location}/securitySettings/{security_settings}" -}; -option (google.api.resource_definition) = { - type: "dialogflow.googleapis.com/ConversationModel" - pattern: "projects/{project}/locations/{location}/conversationModels/{conversation_model}" -}; - -// Service for managing [ConversationProfiles][google.cloud.dialogflow.v2beta1.ConversationProfile]. -service ConversationProfiles { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Returns the list of all conversation profiles in the specified project. - rpc ListConversationProfiles(ListConversationProfilesRequest) returns (ListConversationProfilesResponse) { - option (google.api.http) = { - get: "/v2beta1/{parent=projects/*}/conversationProfiles" - additional_bindings { - get: "/v2beta1/{parent=projects/*/locations/*}/conversationProfiles" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves the specified conversation profile. - rpc GetConversationProfile(GetConversationProfileRequest) returns (ConversationProfile) { - option (google.api.http) = { - get: "/v2beta1/{name=projects/*/conversationProfiles/*}" - additional_bindings { - get: "/v2beta1/{name=projects/*/locations/*/conversationProfiles/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a conversation profile in the specified project. - // - // [ConversationProfile.CreateTime][] and [ConversationProfile.UpdateTime][] - // aren't populated in the response. You can retrieve them via - // [GetConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile] API. - rpc CreateConversationProfile(CreateConversationProfileRequest) returns (ConversationProfile) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*}/conversationProfiles" - body: "conversation_profile" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*}/conversationProfiles" - body: "conversation_profile" - } - }; - option (google.api.method_signature) = "parent,conversation_profile"; - } - - // Updates the specified conversation profile. - // - // [ConversationProfile.CreateTime][] and [ConversationProfile.UpdateTime][] - // aren't populated in the response. You can retrieve them via - // [GetConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile] API. - rpc UpdateConversationProfile(UpdateConversationProfileRequest) returns (ConversationProfile) { - option (google.api.http) = { - patch: "/v2beta1/{conversation_profile.name=projects/*/conversationProfiles/*}" - body: "conversation_profile" - additional_bindings { - patch: "/v2beta1/{conversation_profile.name=projects/*/locations/*/conversationProfiles/*}" - body: "conversation_profile" - } - }; - option (google.api.method_signature) = "conversation_profile,update_mask"; - } - - // Deletes the specified conversation profile. - rpc DeleteConversationProfile(DeleteConversationProfileRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2beta1/{name=projects/*/conversationProfiles/*}" - additional_bindings { - delete: "/v2beta1/{name=projects/*/locations/*/conversationProfiles/*}" - } - }; - option (google.api.method_signature) = "name"; - } -} - -// Defines the services to connect to incoming Dialogflow conversations. -message ConversationProfile { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/ConversationProfile" - pattern: "projects/{project}/conversationProfiles/{conversation_profile}" - pattern: "projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}" - }; - - // The unique identifier of this conversation profile. - // Format: `projects//locations//conversationProfiles/`. - string name = 1; - - // Required. Human readable name for this profile. Max length 1024 bytes. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Output only. Create time of the conversation profile. - google.protobuf.Timestamp create_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Update time of the conversation profile. - google.protobuf.Timestamp update_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Configuration for an automated agent to use with this profile. - AutomatedAgentConfig automated_agent_config = 3; - - // Configuration for agent assistance to use with this profile. - HumanAgentAssistantConfig human_agent_assistant_config = 4; - - // Configuration for connecting to a live agent. - // - // Currently, this feature is not general available, please contact Google - // to get access. - HumanAgentHandoffConfig human_agent_handoff_config = 5; - - // Configuration for publishing conversation lifecycle events. - NotificationConfig notification_config = 6; - - // Configuration for logging conversation lifecycle events. - LoggingConfig logging_config = 7; - - // Configuration for publishing new message events. Event will be sent in - // format of [ConversationEvent][google.cloud.dialogflow.v2beta1.ConversationEvent] - NotificationConfig new_message_event_notification_config = 8; - - // Settings for speech transcription. - SpeechToTextConfig stt_config = 9; - - // Language code for the conversation profile. If not specified, the language - // is en-US. Language at ConversationProfile should be set for all non en-us - // languages. - string language_code = 10; -} - -// Defines the Automated Agent to connect to a conversation. -message AutomatedAgentConfig { - // Required. ID of the Dialogflow agent environment to use. - // - // This project needs to either be the same project as the conversation or you - // need to grant `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow API - // Service Agent` role in this project. - // - // - For ES agents, use format: `projects//locations//agent/environments/`. If environment is not - // specified, the default `draft` environment is used. Refer to - // [DetectIntentRequest](/dialogflow/docs/reference/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.DetectIntentRequest) - // for more details. - // - // - For CX agents, use format `projects//locations//agents//environments/`. If environment is not specified, the default `draft` environment - // is used. - string agent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Agent" - } - ]; -} - -// Defines the Human Agent Assistant to connect to a conversation. -message HumanAgentAssistantConfig { - // Settings of suggestion trigger. - message SuggestionTriggerSettings { - // Do not trigger if last utterance is small talk. - bool no_small_talk = 1; - - // Only trigger suggestion if participant role of last utterance is - // END_USER. - bool only_end_user = 2; - } - - // Config for suggestion features. - message SuggestionFeatureConfig { - // The suggestion feature. - SuggestionFeature suggestion_feature = 5; - - // Automatically iterates all participants and tries to compile - // suggestions. - // - // Supported features: ARTICLE_SUGGESTION, FAQ, DIALOGFLOW_ASSIST. - bool enable_event_based_suggestion = 3; - - // Settings of suggestion trigger. - // - // Currently, only ARTICLE_SUGGESTION, FAQ, and DIALOGFLOW_ASSIST will use - // this field. - SuggestionTriggerSettings suggestion_trigger_settings = 10; - - // Configs of query. - SuggestionQueryConfig query_config = 6; - - // Configs of custom conversation model. - ConversationModelConfig conversation_model_config = 7; - } - - // Detail human agent assistant config. - message SuggestionConfig { - // Configuration of different suggestion features. One feature can have only - // one config. - repeated SuggestionFeatureConfig feature_configs = 2; - - // If `group_suggestion_responses` is false, and there are multiple - // `feature_configs` in `event based suggestion` or - // StreamingAnalyzeContent, we will try to deliver suggestions to customers - // as soon as we get new suggestion. Different type of suggestions based on - // the same context will be in separate Pub/Sub event or - // `StreamingAnalyzeContentResponse`. - // - // If `group_suggestion_responses` set to true. All the suggestions to the - // same participant based on the same context will be grouped into a single - // Pub/Sub event or StreamingAnalyzeContentResponse. - bool group_suggestion_responses = 3; - } - - // Config for suggestion query. - message SuggestionQueryConfig { - // Knowledge base source settings. - // - // Supported features: ARTICLE_SUGGESTION, FAQ. - message KnowledgeBaseQuerySource { - // Required. Knowledge bases to query. Format: - // `projects//locations//knowledgeBases/`. Currently, only one knowledge - // base is supported. - repeated string knowledge_bases = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/KnowledgeBase" - } - ]; - } - - // Document source settings. - // - // Supported features: SMART_REPLY, SMART_COMPOSE. - message DocumentQuerySource { - // Required. Knowledge documents to query from. Format: - // `projects//locations//knowledgeBases//documents/`. - // Currently, only one document is supported. - repeated string documents = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Document" - } - ]; - } - - // Dialogflow source setting. - // - // Supported feature: DIALOGFLOW_ASSIST. - message DialogflowQuerySource { - // Required. The name of a dialogflow virtual agent used for end user side intent - // detection and suggestion. Format: `projects//locations//agent`. When multiple agents are allowed in - // the same Dialogflow project. - string agent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Agent" - } - ]; - } - - // Settings that determine how to filter recent conversation context when - // generating suggestions. - message ContextFilterSettings { - // If set to true, the last message from virtual agent (hand off message) - // and the message before it (trigger message of hand off) are dropped. - bool drop_handoff_messages = 1; - - // If set to true, all messages from virtual agent are dropped. - bool drop_virtual_agent_messages = 2; - - // If set to true, all messages from ivr stage are dropped. - bool drop_ivr_messages = 3; - } - - // Source of query. - oneof query_source { - // Query from knowledgebase. It is used by: - // ARTICLE_SUGGESTION, FAQ. - KnowledgeBaseQuerySource knowledge_base_query_source = 1; - - // Query from knowledge base document. It is used by: - // SMART_REPLY, SMART_COMPOSE. - DocumentQuerySource document_query_source = 2; - - // Query from Dialogflow agent. It is used by DIALOGFLOW_ASSIST. - DialogflowQuerySource dialogflow_query_source = 3; - } - - // Maximum number of results to return. Currently, if unset, defaults to 10. - // And the max number is 20. - int32 max_results = 4; - - // Confidence threshold of query result. - // - // Agent Assist gives each suggestion a score in the range [0.0, 1.0], based - // on the relevance between the suggestion and the current conversation - // context. A score of 0.0 has no relevance, while a score of 1.0 has high - // relevance. Only suggestions with a score greater than or equal to the - // value of this field are included in the results. - // - // For a baseline model (the default), the recommended value is in the range - // [0.05, 0.1]. - // - // For a custom model, there is no recommended value. Tune this value by - // starting from a very low value and slowly increasing until you have - // desired results. - // - // If this field is not set, it is default to 0.0, which means that all - // suggestions are returned. - // - // Supported features: ARTICLE_SUGGESTION, FAQ, SMART_REPLY, SMART_COMPOSE. - float confidence_threshold = 5; - - // Determines how recent conversation context is filtered when generating - // suggestions. If unspecified, no messages will be dropped. - ContextFilterSettings context_filter_settings = 7; - } - - // Custom conversation models used in agent assist feature. - // - // Supported feature: ARTICLE_SUGGESTION, SMART_COMPOSE, SMART_REPLY. - message ConversationModelConfig { - // Conversation model resource name. Format: `projects//conversationModels/`. - string model = 1 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/ConversationModel" - }]; - } - - // Configuration for analyses to run on each conversation message. - message MessageAnalysisConfig { - // Enable entity extraction in conversation messages on [agent assist - // stage](https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages). - // If unspecified, defaults to false. - // - // Currently, this feature is not general available, please contact Google - // to get access. - bool enable_entity_extraction = 2; - - // Enable sentiment analysis in conversation messages on [agent assist - // stage](https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages). - // If unspecified, defaults to false. Sentiment analysis inspects user input - // and identifies the prevailing subjective opinion, especially to determine - // a user's attitude as positive, negative, or neutral: - // https://cloud.google.com/natural-language/docs/basics#sentiment_analysis - // For [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent] method, result will be in - // [StreamingAnalyzeContentResponse.message.SentimentAnalysisResult][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse.message]. - // For [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] method, result will be in - // [AnalyzeContentResponse.message.SentimentAnalysisResult][google.cloud.dialogflow.v2beta1.AnalyzeContentResponse.message] - // For [Conversations.ListMessages][google.cloud.dialogflow.v2beta1.Conversations.ListMessages] method, result will be in - // [ListMessagesResponse.messages.SentimentAnalysisResult][google.cloud.dialogflow.v2beta1.ListMessagesResponse.messages] - // If Pub/Sub notification is configured, result will be in - // [ConversationEvent.new_message_payload.SentimentAnalysisResult][google.cloud.dialogflow.v2beta1.ConversationEvent.new_message_payload]. - bool enable_sentiment_analysis = 3; - } - - // Pub/Sub topic on which to publish new agent assistant events. - NotificationConfig notification_config = 2; - - // Configuration for agent assistance of human agent participant. - SuggestionConfig human_agent_suggestion_config = 3; - - // Configuration for agent assistance of end user participant. - // - // Currently, this feature is not general available, please contact Google - // to get access. - SuggestionConfig end_user_suggestion_config = 4; - - // Configuration for message analysis. - MessageAnalysisConfig message_analysis_config = 5; -} - -// Defines the hand off to a live agent, typically on which external agent -// service provider to connect to a conversation. -// -// Currently, this feature is not general available, please contact Google -// to get access. -message HumanAgentHandoffConfig { - // Configuration specific to LivePerson (https://www.liveperson.com). - message LivePersonConfig { - // Required. Account number of the LivePerson account to connect. This is - // the account number you input at the login page. - string account_number = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // Configuration specific to Salesforce Live Agent. - message SalesforceLiveAgentConfig { - // Required. The organization ID of the Salesforce account. - string organization_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Live Agent deployment ID. - string deployment_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Live Agent chat button ID. - string button_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Domain of the Live Agent endpoint for this agent. You can find - // the endpoint URL in the `Live Agent settings` page. For example if URL - // has the form https://d.la4-c2-phx.salesforceliveagent.com/..., - // you should fill in d.la4-c2-phx.salesforceliveagent.com. - string endpoint_domain = 4 [(google.api.field_behavior) = REQUIRED]; - } - - // Required. Specifies which agent service to connect for human agent handoff. - oneof agent_service { - // Uses LivePerson (https://www.liveperson.com). - LivePersonConfig live_person_config = 1; - - // Uses Salesforce Live Agent. - SalesforceLiveAgentConfig salesforce_live_agent_config = 2; - } -} - -// Defines notification behavior. -message NotificationConfig { - // Format of cloud pub/sub message. - enum MessageFormat { - // If it is unspecified, PROTO will be used. - MESSAGE_FORMAT_UNSPECIFIED = 0; - - // Pubsub message will be serialized proto. - PROTO = 1; - - // Pubsub message will be json. - JSON = 2; - } - - // Name of the Pub/Sub topic to publish conversation - // events like - // [CONVERSATION_STARTED][google.cloud.dialogflow.v2beta1.ConversationEvent.Type.CONVERSATION_STARTED] as - // serialized [ConversationEvent][google.cloud.dialogflow.v2beta1.ConversationEvent] protos. - // - // Notification works for phone calls, if this topic either is in the same - // project as the conversation or you grant `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow Service - // Agent` role in the topic project. - // - // Format: `projects//locations//topics/`. - string topic = 1; - - // Format of message. - MessageFormat message_format = 2; -} - -// Defines logging behavior for conversation lifecycle events. -message LoggingConfig { - // Whether to log conversation events like - // [CONVERSATION_STARTED][google.cloud.dialogflow.v2beta1.ConversationEvent.Type.CONVERSATION_STARTED] to - // Stackdriver in the conversation project as JSON format - // [ConversationEvent][google.cloud.dialogflow.v2beta1.ConversationEvent] protos. - bool enable_stackdriver_logging = 3; -} - -// The request message for [ConversationProfiles.ListConversationProfiles][google.cloud.dialogflow.v2beta1.ConversationProfiles.ListConversationProfiles]. -message ListConversationProfilesRequest { - // Required. The project to list all conversation profiles from. - // Format: `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/ConversationProfile" - } - ]; - - // The maximum number of items to return in a single page. By - // default 100 and at most 1000. - int32 page_size = 2; - - // The next_page_token value returned from a previous list request. - string page_token = 3; -} - -// The response message for [ConversationProfiles.ListConversationProfiles][google.cloud.dialogflow.v2beta1.ConversationProfiles.ListConversationProfiles]. -message ListConversationProfilesResponse { - // The list of project conversation profiles. There is a maximum number - // of items returned based on the page_size field in the request. - repeated ConversationProfile conversation_profiles = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request message for [ConversationProfiles.GetConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile]. -message GetConversationProfileRequest { - // Required. The resource name of the conversation profile. - // Format: `projects//locations//conversationProfiles/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/ConversationProfile" - } - ]; -} - -// The request message for [ConversationProfiles.CreateConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfiles.CreateConversationProfile]. -message CreateConversationProfileRequest { - // Required. The project to create a conversation profile for. - // Format: `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/ConversationProfile" - } - ]; - - // Required. The conversation profile to create. - ConversationProfile conversation_profile = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [ConversationProfiles.UpdateConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfiles.UpdateConversationProfile]. -message UpdateConversationProfileRequest { - // Required. The conversation profile to update. - ConversationProfile conversation_profile = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The mask to control which fields to update. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [ConversationProfiles.DeleteConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfiles.DeleteConversationProfile]. -// -// This operation fails if the conversation profile is still referenced from -// a phone number. -message DeleteConversationProfileRequest { - // Required. The name of the conversation profile to delete. - // Format: `projects//locations//conversationProfiles/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/ConversationProfile" - } - ]; -} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/document.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/document.proto deleted file mode 100644 index 25fdf0ce..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/document.proto +++ /dev/null @@ -1,533 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dialogflow/v2beta1/gcs.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "DocumentProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; - -// Service for managing knowledge [Documents][google.cloud.dialogflow.v2beta1.Document]. -service Documents { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Returns the list of all documents of the knowledge base. - // - // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; - // only use `projects.knowledgeBases.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" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves the specified document. - // - // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; - // only use `projects.knowledgeBases.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/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new document. - // - // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; - // only use `projects.knowledgeBases.documents`. - rpc CreateDocument(CreateDocumentRequest) returns (google.longrunning.Operation) { - 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" - } - }; - option (google.api.method_signature) = "parent,document"; - option (google.longrunning.operation_info) = { - response_type: "Document" - metadata_type: "KnowledgeOperationMetadata" - }; - } - - // Create documents by importing data from external sources. - // Dialogflow supports up to 350 documents in each request. If you try to - // import more, Dialogflow will return an error. - rpc ImportDocuments(ImportDocumentsRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*/knowledgeBases/*}/documents:import" - body: "*" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/knowledgeBases/*}/documents:import" - body: "*" - } - }; - option (google.longrunning.operation_info) = { - response_type: "ImportDocumentsResponse" - metadata_type: "KnowledgeOperationMetadata" - }; - } - - // Deletes the specified document. - // - // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; - // only use `projects.knowledgeBases.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/*}" - } - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "KnowledgeOperationMetadata" - }; - } - - // Updates the specified document. - // - // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; - // only use `projects.knowledgeBases.documents`. - rpc UpdateDocument(UpdateDocumentRequest) returns (google.longrunning.Operation) { - 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" - } - }; - option (google.api.method_signature) = "document,update_mask"; - option (google.api.method_signature) = "document"; - option (google.longrunning.operation_info) = { - response_type: "Document" - metadata_type: "KnowledgeOperationMetadata" - }; - } - - // Reloads the specified document from its specified source, content_uri or - // content. The previously loaded content of the document will be deleted. - // Note: Even when the content of the document has not changed, there still - // may be side effects because of internal implementation changes. - // Note: If the document source is Google Cloud Storage URI, its metadata will - // be replaced with the custom metadata from Google Cloud Storage if the - // `import_gcs_custom_metadata` field is set to true in the request. - // - // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; - // only use `projects.knowledgeBases.documents`. - rpc ReloadDocument(ReloadDocumentRequest) returns (google.longrunning.Operation) { - 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: "*" - } - }; - option (google.api.method_signature) = "name,gcs_source"; - option (google.longrunning.operation_info) = { - response_type: "Document" - metadata_type: "KnowledgeOperationMetadata" - }; - } -} - -// A knowledge document to be used by a [KnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBase]. -// -// For more information, see the [knowledge base -// guide](https://cloud.google.com/dialogflow/docs/how/knowledge-bases). -// -// Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; -// only use `projects.knowledgeBases.documents`. -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. - message ReloadStatus { - // Output only. The time of a reload attempt. - // This reload may have been triggered automatically or manually and may - // not have succeeded. - google.protobuf.Timestamp time = 1; - - // Output only. The status of a reload attempt or the initial load. - google.rpc.Status status = 2; - } - - // The knowledge type of document content. - enum KnowledgeType { - // The type is unspecified or arbitrary. - KNOWLEDGE_TYPE_UNSPECIFIED = 0; - - // The document content contains question and answer pairs as either HTML or - // CSV. Typical FAQ HTML formats are parsed accurately, but unusual formats - // may fail to be parsed. - // - // CSV must have questions in the first column and answers in the second, - // with no header. Because of this explicit format, they are always parsed - // accurately. - FAQ = 1; - - // Documents for which unstructured text is extracted and used for - // question answering. - EXTRACTIVE_QA = 2; - - // The entire document content as a whole can be used for query results. - // Only for Contact Center Solutions on Dialogflow. - ARTICLE_SUGGESTION = 3; - - // The legacy enum for agent-facing smart reply feature. - SMART_REPLY = 4; - } - - // Optional. The document resource name. - // The name must be empty when creating a document. - // 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 - // less; otherwise, the creation request fails. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The MIME type of this document. - string mime_type = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The knowledge type of document content. - repeated KnowledgeType knowledge_types = 4 [(google.api.field_behavior) = REQUIRED]; - - // The source of this document. - oneof source { - // The URI where the file content is located. - // - // For documents stored in Google Cloud Storage, these URIs must have - // the form `gs:///`. - // - // NOTE: External URLs must correspond to public webpages, i.e., they must - // be indexed by Google Search. In particular, URLs for showing documents in - // Google Cloud Storage (i.e. the URL in your browser) are not supported. - // Instead use the `gs://` format URI described above. - string content_uri = 5; - - // The raw content of the document. This field is only permitted for - // EXTRACTIVE_QA and FAQ knowledge types. - // Note: This field is in the process of being deprecated, please use - // raw_content instead. - string content = 6 [deprecated = true]; - - // The raw content of the document. This field is only permitted for - // EXTRACTIVE_QA and FAQ knowledge types. - bytes raw_content = 9; - } - - // Optional. If true, we try to automatically reload the document every day - // (at a time picked by the system). If false or unspecified, we don't try - // to automatically reload the document. - // - // Currently you can only enable automatic reload for documents sourced from - // a public url, see `source` field for the source types. - // - // Reload status can be tracked in `latest_reload_status`. If a reload - // fails, we will keep the document unchanged. - // - // If a reload fails with internal errors, the system will try to reload the - // document on the next day. - // If a reload fails with non-retriable errors (e.g. PERMISION_DENIED), the - // system will not try to reload the document anymore. You need to manually - // reload the document successfully by calling `ReloadDocument` and clear the - // errors. - bool enable_auto_reload = 11 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The time and status of the latest reload. - // This reload may have been triggered automatically or manually - // and may not have succeeded. - ReloadStatus latest_reload_status = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Metadata for the document. The metadata supports arbitrary - // key-value pairs. Suggested use cases include storing a document's title, - // an external URL distinct from the document's content_uri, etc. - // The max size of a `key` or a `value` of the metadata is 1024 bytes. - map metadata = 7 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [Documents.GetDocument][google.cloud.dialogflow.v2beta1.Documents.GetDocument]. -message GetDocumentRequest { - // Required. The name of the document to retrieve. - // Format `projects//locations//knowledgeBases//documents/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Document" - } - ]; -} - -// Request message for [Documents.ListDocuments][google.cloud.dialogflow.v2beta1.Documents.ListDocuments]. -message ListDocumentsRequest { - // Required. The knowledge base to list all documents for. - // Format: `projects//locations//knowledgeBases/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Document" - } - ]; - - // The maximum number of items to return in a single page. By - // default 10 and at most 100. - int32 page_size = 2; - - // The next_page_token value returned from a previous list request. - string page_token = 3; - - // The filter expression used to filter documents returned by the list method. - // The expression has the following syntax: - // - // [AND ] ... - // - // The following fields and operators are supported: - // - // * knowledge_types with has(:) operator - // * display_name with has(:) operator - // * state with equals(=) operator - // - // Examples: - // - // * "knowledge_types:FAQ" matches documents with FAQ knowledge type. - // * "display_name:customer" matches documents whose display name contains - // "customer". - // * "state=ACTIVE" matches documents with ACTIVE state. - // * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. - // - // For more information about filtering, see - // [API Filtering](https://aip.dev/160). - string filter = 4; -} - -// Response message for [Documents.ListDocuments][google.cloud.dialogflow.v2beta1.Documents.ListDocuments]. -message ListDocumentsResponse { - // The list of documents. - repeated Document documents = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// Request message for [Documents.CreateDocument][google.cloud.dialogflow.v2beta1.Documents.CreateDocument]. -message CreateDocumentRequest { - // Required. The knowledge base to create a document for. - // Format: `projects//locations//knowledgeBases/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Document" - } - ]; - - // 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.ImportDocuments][google.cloud.dialogflow.v2beta1.Documents.ImportDocuments]. -message ImportDocumentsRequest { - // Required. The knowledge base to import documents into. - // Format: `projects//locations//knowledgeBases/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Document" - } - ]; - - // Required. The source to use for importing documents. - // - // If the source captures multiple objects, then multiple documents will be - // created, one corresponding to each object, and all of these documents will - // be created using the same document template. - // - // Dialogflow supports up to 350 documents in each request. If you try to - // import more, Dialogflow will return an error. - oneof source { - // The Google Cloud Storage location for the documents. - // The path can include a wildcard. - // - // These URIs may have the forms - // `gs:///`. - // `gs:////*.`. - GcsSources gcs_source = 2; - } - - // Required. Document template used for importing all the documents. - ImportDocumentTemplate document_template = 3 [(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 = 4; -} - -// The template used for importing documents. -message ImportDocumentTemplate { - // Required. The MIME type of the document. - string mime_type = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The knowledge type of document content. - repeated Document.KnowledgeType knowledge_types = 2 [(google.api.field_behavior) = REQUIRED]; - - // Metadata for the document. The metadata supports arbitrary - // key-value pairs. Suggested use cases include storing a document's title, - // an external URL distinct from the document's content_uri, etc. - // The max size of a `key` or a `value` of the metadata is 1024 bytes. - map metadata = 3; -} - -// Response message for [Documents.ImportDocuments][google.cloud.dialogflow.v2beta1.Documents.ImportDocuments]. -message ImportDocumentsResponse { - // Includes details about skipped documents or any other warnings. - repeated google.rpc.Status warnings = 1; -} - -// Request message for [Documents.DeleteDocument][google.cloud.dialogflow.v2beta1.Documents.DeleteDocument]. -message DeleteDocumentRequest { - // Required. The name of the document to delete. - // Format: `projects//locations//knowledgeBases//documents/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Document" - } - ]; -} - -// Request message for [Documents.UpdateDocument][google.cloud.dialogflow.v2beta1.Documents.UpdateDocument]. -message UpdateDocumentRequest { - // Required. The document to update. - Document document = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Not specified means `update all`. - // Currently, only `display_name` can be updated, an InvalidArgument will be - // returned for attempting to update other fields. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Metadata in google::longrunning::Operation for Knowledge operations. -message KnowledgeOperationMetadata { - // States of the operation. - enum State { - // State unspecified. - STATE_UNSPECIFIED = 0; - - // The operation has been created. - PENDING = 1; - - // The operation is currently running. - RUNNING = 2; - - // The operation is done, either cancelled or completed. - DONE = 3; - } - - // Required. Output only. The current state of this operation. - State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request message for [Documents.ReloadDocument][google.cloud.dialogflow.v2beta1.Documents.ReloadDocument]. -message ReloadDocumentRequest { - // Required. The name of the document to reload. - // Format: `projects//locations//knowledgeBases//documents/` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Document" - } - ]; - - // The source for document reloading. - // Optional. If provided, the service will load the contents from the source - // and update document in the knowledge base. - oneof source { - // The path for a Cloud Storage source file for reloading document content. - // 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/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/entity_type.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/entity_type.proto deleted file mode 100644 index a1703f1b..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/entity_type.proto +++ /dev/null @@ -1,571 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "EntityTypeProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; - -// Service for managing [EntityTypes][google.cloud.dialogflow.v2beta1.EntityType]. -service EntityTypes { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Returns the list of all entity types in the specified agent. - rpc ListEntityTypes(ListEntityTypesRequest) returns (ListEntityTypesResponse) { - option (google.api.http) = { - get: "/v2beta1/{parent=projects/*/agent}/entityTypes" - additional_bindings { - get: "/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes" - } - }; - option (google.api.method_signature) = "parent"; - option (google.api.method_signature) = "parent,language_code"; - } - - // Retrieves the specified entity type. - rpc GetEntityType(GetEntityTypeRequest) returns (EntityType) { - option (google.api.http) = { - get: "/v2beta1/{name=projects/*/agent/entityTypes/*}" - additional_bindings { - get: "/v2beta1/{name=projects/*/locations/*/agent/entityTypes/*}" - } - }; - option (google.api.method_signature) = "name"; - option (google.api.method_signature) = "name,language_code"; - } - - // Creates an entity type in the specified agent. - rpc CreateEntityType(CreateEntityTypeRequest) returns (EntityType) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*/agent}/entityTypes" - body: "entity_type" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes" - body: "entity_type" - } - }; - option (google.api.method_signature) = "parent,entity_type"; - option (google.api.method_signature) = "parent,entity_type,language_code"; - } - - // Updates the specified entity type. - rpc UpdateEntityType(UpdateEntityTypeRequest) returns (EntityType) { - option (google.api.http) = { - patch: "/v2beta1/{entity_type.name=projects/*/agent/entityTypes/*}" - body: "entity_type" - additional_bindings { - patch: "/v2beta1/{entity_type.name=projects/*/locations/*/agent/entityTypes/*}" - body: "entity_type" - } - }; - option (google.api.method_signature) = "entity_type"; - option (google.api.method_signature) = "entity_type,language_code"; - option (google.api.method_signature) = "entity_type,language_code,update_mask"; - } - - // Deletes the specified entity type. - rpc DeleteEntityType(DeleteEntityTypeRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2beta1/{name=projects/*/agent/entityTypes/*}" - additional_bindings { - delete: "/v2beta1/{name=projects/*/locations/*/agent/entityTypes/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Updates/Creates multiple entity types in the specified agent. - // Operation - rpc BatchUpdateEntityTypes(BatchUpdateEntityTypesRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*/agent}/entityTypes:batchUpdate" - body: "*" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes:batchUpdate" - body: "*" - } - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse" - metadata_type: "google.protobuf.Struct" - }; - } - - // Deletes entity types in the specified agent. - // Operation - rpc BatchDeleteEntityTypes(BatchDeleteEntityTypesRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*/agent}/entityTypes:batchDelete" - body: "*" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes:batchDelete" - body: "*" - } - }; - option (google.api.method_signature) = "parent,entity_type_names"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Struct" - }; - } - - // Creates multiple new entities in the specified entity type. - // - // Operation - rpc BatchCreateEntities(BatchCreateEntitiesRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchCreate" - body: "*" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchCreate" - body: "*" - } - }; - option (google.api.method_signature) = "parent,entities"; - option (google.api.method_signature) = "parent,entities,language_code"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Struct" - }; - } - - // Updates or creates multiple entities in the specified entity type. This - // method does not affect entities in the entity type that aren't explicitly - // specified in the request. - // - // Operation - rpc BatchUpdateEntities(BatchUpdateEntitiesRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchUpdate" - body: "*" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchUpdate" - body: "*" - } - }; - option (google.api.method_signature) = "parent,entities"; - option (google.api.method_signature) = "parent,entities,language_code"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Struct" - }; - } - - // Deletes entities in the specified entity type. - // - // Operation - rpc BatchDeleteEntities(BatchDeleteEntitiesRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchDelete" - body: "*" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchDelete" - body: "*" - } - }; - option (google.api.method_signature) = "parent,entity_values"; - option (google.api.method_signature) = "parent,entity_values,language_code"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Struct" - }; - } -} - -// Each intent parameter has a type, called the entity type, which dictates -// exactly how data from an end-user expression is extracted. -// -// Dialogflow provides predefined system entities that can match many common -// types of data. For example, there are system entities for matching dates, -// times, colors, email addresses, and so on. You can also create your own -// custom entities for matching custom data. For example, you could define a -// vegetable entity that can match the types of vegetables available for -// purchase with a grocery store agent. -// -// For more information, see the -// [Entity guide](https://cloud.google.com/dialogflow/docs/entities-overview). -message EntityType { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/EntityType" - pattern: "projects/{project}/agent/entityTypes/{entity_type}" - pattern: "projects/{project}/locations/{location}/agent/entityTypes/{entity_type}" - }; - - // An **entity entry** for an associated entity type. - message Entity { - // Required. The primary value associated with this entity entry. - // For example, if the entity type is *vegetable*, the value could be - // *scallions*. - // - // For `KIND_MAP` entity types: - // - // * A reference value to be used in place of synonyms. - // - // For `KIND_LIST` entity types: - // - // * A string that can contain references to other entity types (with or - // without aliases). - string value = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A collection of value synonyms. For example, if the entity type - // is *vegetable*, and `value` is *scallions*, a synonym could be *green - // onions*. - // - // For `KIND_LIST` entity types: - // - // * This collection must contain exactly one synonym equal to `value`. - repeated string synonyms = 2; - } - - // Represents kinds of entities. - enum Kind { - // Not specified. This value should be never used. - KIND_UNSPECIFIED = 0; - - // Map entity types allow mapping of a group of synonyms to a reference - // value. - KIND_MAP = 1; - - // List entity types contain a set of entries that do not map to reference - // values. However, list entity types can contain references to other entity - // types (with or without aliases). - KIND_LIST = 2; - - // Regexp entity types allow to specify regular expressions in entries - // values. - KIND_REGEXP = 3; - } - - // Represents different entity type expansion modes. Automated expansion - // allows an agent to recognize values that have not been explicitly listed in - // the entity (for example, new kinds of shopping list items). - enum AutoExpansionMode { - // Auto expansion disabled for the entity. - AUTO_EXPANSION_MODE_UNSPECIFIED = 0; - - // Allows an agent to recognize values that have not been explicitly - // listed in the entity. - AUTO_EXPANSION_MODE_DEFAULT = 1; - } - - // The unique identifier of the entity type. - // Required for [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType] and - // [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes] methods. - // Supported formats: - // - `projects//agent/entityTypes/` - // - `projects//locations//agent/entityTypes/` - string name = 1; - - // Required. The name of the entity type. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Indicates the kind of entity type. - Kind kind = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Indicates whether the entity type can be automatically - // expanded. - AutoExpansionMode auto_expansion_mode = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The collection of entity entries associated with the entity type. - repeated Entity entities = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Enables fuzzy entity extraction during classification. - bool enable_fuzzy_extraction = 7 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes]. -message ListEntityTypesRequest { - // Required. The agent to list all entity types from. - // Supported formats: - // - `projects//agent` - // - `projects//locations//agent` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/EntityType" - } - ]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of items to return in a single page. By - // default 100 and at most 1000. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes]. -message ListEntityTypesResponse { - // The list of agent entity types. There will be a maximum number of items - // returned based on the page_size field in the request. - repeated EntityType entity_types = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request message for [EntityTypes.GetEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType]. -message GetEntityTypeRequest { - // Required. The name of the entity type. - // Supported formats: - // - `projects//agent/entityTypes/` - // - `projects//locations//agent/entityTypes/` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/EntityType" - } - ]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [EntityTypes.CreateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.CreateEntityType]. -message CreateEntityTypeRequest { - // Required. The agent to create a entity type for. - // Supported formats: - // - `projects//agent` - // - `projects//locations//agent` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/EntityType" - } - ]; - - // Required. The entity type to create. - EntityType entity_type = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType]. -message UpdateEntityTypeRequest { - // Required. The entity type to update. - EntityType entity_type = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [EntityTypes.DeleteEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.DeleteEntityType]. -message DeleteEntityTypeRequest { - // Required. The name of the entity type to delete. - // Supported formats: - // - `projects//agent/entityTypes/` - // - `projects//locations//agent/entityTypes/` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/EntityType" - } - ]; -} - -// The request message for [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes]. -message BatchUpdateEntityTypesRequest { - // Required. The name of the agent to update or create entity types in. - // Supported formats: - // - `projects//agent` - // - `projects//locations//agent` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/EntityType" - } - ]; - - // The source of the entity type batch. - // - // For each entity type in the batch: - // - // * If `name` is specified, we update an existing entity type. - // * If `name` is not specified, we create a new entity type. - oneof entity_type_batch { - // The URI to a Google Cloud Storage file containing entity types to update - // or create. The file format can either be a serialized proto (of - // EntityBatch type) or a JSON object. Note: The URI must start with - // "gs://". - string entity_type_batch_uri = 2; - - // The collection of entity types to update or create. - EntityTypeBatch entity_type_batch_inline = 3; - } - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response message for [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes]. -message BatchUpdateEntityTypesResponse { - // The collection of updated or created entity types. - repeated EntityType entity_types = 1; -} - -// The request message for [EntityTypes.BatchDeleteEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntityTypes]. -message BatchDeleteEntityTypesRequest { - // Required. The name of the agent to delete all entities types for. - // Supported formats: - // - `projects//agent`, - // - `projects//locations//agent`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/EntityType" - } - ]; - - // Required. The names entity types to delete. All names must point to the - // same agent as `parent`. - repeated string entity_type_names = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntities]. -message BatchCreateEntitiesRequest { - // Required. The name of the entity type to create entities in. - // Supported formats: - // - `projects//agent/entityTypes/` - // - `projects//locations//agent/entityTypes/` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/EntityType" - } - ]; - - // Required. The entities to create. - repeated EntityType.Entity entities = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [EntityTypes.BatchUpdateEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntities]. -message BatchUpdateEntitiesRequest { - // Required. The name of the entity type to update or create entities in. - // Supported formats: - // - `projects//agent/entityTypes/` - // - `projects//locations//agent/entityTypes/` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/EntityType" - } - ]; - - // Required. The entities to update or create. - repeated EntityType.Entity entities = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 4; -} - -// The request message for [EntityTypes.BatchDeleteEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntities]. -message BatchDeleteEntitiesRequest { - // Required. The name of the entity type to delete entries for. - // Supported formats: - // - `projects//agent/entityTypes/` - // - `projects//locations//agent/entityTypes/` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/EntityType" - } - ]; - - // Required. The reference `values` of the entities to delete. Note that - // these are not fully-qualified names, i.e. they don't start with - // `projects/`. - repeated string entity_values = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// This message is a wrapper around a collection of entity types. -message EntityTypeBatch { - // A collection of entity types. - repeated EntityType entity_types = 1; -} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/environment.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/environment.proto deleted file mode 100644 index 226c9a0d..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/environment.proto +++ /dev/null @@ -1,367 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dialogflow/v2beta1/audio_config.proto"; -import "google/cloud/dialogflow/v2beta1/fulfillment.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "EnvironmentProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; - -// Service for managing [Environments][google.cloud.dialogflow.v2beta1.Environment]. -service Environments { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Returns the list of all non-draft environments of the specified agent. - rpc ListEnvironments(ListEnvironmentsRequest) returns (ListEnvironmentsResponse) { - option (google.api.http) = { - get: "/v2beta1/{parent=projects/*/agent}/environments" - additional_bindings { - get: "/v2beta1/{parent=projects/*/locations/*/agent}/environments" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves the specified agent environment. - rpc GetEnvironment(GetEnvironmentRequest) returns (Environment) { - option (google.api.http) = { - get: "/v2beta1/{name=projects/*/agent/environments/*}" - additional_bindings { - get: "/v2beta1/{name=projects/*/locations/*/agent/environments/*}" - } - }; - } - - // Creates an agent environment. - rpc CreateEnvironment(CreateEnvironmentRequest) returns (Environment) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*/agent}/environments" - body: "environment" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/agent}/environments" - body: "environment" - } - }; - } - - // Updates the specified agent environment. - // - // This method allows you to deploy new agent versions into the environment. - // When an environment is pointed to a new agent version by setting - // `environment.agent_version`, the environment is temporarily set to the - // `LOADING` state. During that time, the environment keeps on serving the - // previous version of the agent. After the new agent version is done loading, - // the environment is set back to the `RUNNING` state. - // You can use "-" as Environment ID in environment name to update version - // in "draft" environment. WARNING: this will negate all recent changes to - // draft and can't be undone. You may want to save the draft to a version - // before calling this function. - rpc UpdateEnvironment(UpdateEnvironmentRequest) returns (Environment) { - option (google.api.http) = { - patch: "/v2beta1/{environment.name=projects/*/agent/environments/*}" - body: "environment" - additional_bindings { - patch: "/v2beta1/{environment.name=projects/*/locations/*/agent/environments/*}" - body: "environment" - } - }; - } - - // Deletes the specified agent environment. - rpc DeleteEnvironment(DeleteEnvironmentRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2beta1/{name=projects/*/agent/environments/*}" - additional_bindings { - delete: "/v2beta1/{name=projects/*/locations/*/agent/environments/*}" - } - }; - } - - // Gets the history of the specified environment. - rpc GetEnvironmentHistory(GetEnvironmentHistoryRequest) returns (EnvironmentHistory) { - option (google.api.http) = { - get: "/v2beta1/{parent=projects/*/agent/environments/*}/history" - additional_bindings { - get: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*}/history" - } - }; - } -} - -// You can create multiple versions of your agent and publish them to separate -// environments. -// -// When you edit an agent, you are editing the draft agent. At any point, you -// can save the draft agent as an agent version, which is an immutable snapshot -// of your agent. -// -// When you save the draft agent, it is published to the default environment. -// When you create agent versions, you can publish them to custom environments. -// You can create a variety of custom environments for: -// -// - testing -// - development -// - production -// - etc. -// -// For more information, see the [versions and environments -// guide](https://cloud.google.com/dialogflow/docs/agents-versions). -message Environment { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/Environment" - pattern: "projects/{project}/agent/environments/{environment}" - pattern: "projects/{project}/locations/{location}/agent/environments/{environment}" - }; - - // Represents an environment state. When an environment is pointed to a new - // agent version, the environment is temporarily set to the `LOADING` state. - // During that time, the environment keeps on serving the previous version of - // the agent. After the new agent version is done loading, the environment is - // set back to the `RUNNING` state. - enum State { - // Not specified. This value is not used. - STATE_UNSPECIFIED = 0; - - // Stopped. - STOPPED = 1; - - // Loading. - LOADING = 2; - - // Running. - RUNNING = 3; - } - - // Output only. The unique identifier of this agent environment. - // Supported formats: - // - `projects//agent/environments/` - // - `projects//locations//agent/environments/` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The developer-provided description for this environment. - // The maximum length is 500 characters. If exceeded, the request is rejected. - string description = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The agent version loaded into this environment. - // Supported formats: - // - `projects//agent/versions/` - // - `projects//locations//agent/versions/` - string agent_version = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The state of this environment. This field is read-only, i.e., it cannot be - // set by create and update methods. - State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update time of this environment. This field is read-only, i.e., it - // cannot be set by create and update methods. - google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Text to speech settings for this environment. - TextToSpeechSettings text_to_speech_settings = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The fulfillment settings to use for this environment. - Fulfillment fulfillment = 8 [(google.api.field_behavior) = OPTIONAL]; -} - -// Instructs the speech synthesizer on how to generate the output audio content. -message TextToSpeechSettings { - // Optional. Indicates whether text to speech is enabled. Even when this field is false, - // other settings in this proto are still retained. - bool enable_text_to_speech = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Audio encoding of the synthesized audio content. - OutputAudioEncoding output_audio_encoding = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The synthesis sample rate (in hertz) for this audio. If not provided, then - // the synthesizer will use the default sample rate based on the audio - // encoding. If this is different from the voice's natural sample rate, then - // the synthesizer will honor this request by converting to the desired sample - // rate (which might result in worse audio quality). - int32 sample_rate_hertz = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Configuration of how speech should be synthesized, mapping from language - // (https://cloud.google.com/dialogflow/docs/reference/language) to - // SynthesizeSpeechConfig. - map synthesize_speech_configs = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [Environments.ListEnvironments][google.cloud.dialogflow.v2beta1.Environments.ListEnvironments]. -message ListEnvironmentsRequest { - // Required. The agent to list all environments from. - // Format: - // - `projects//agent` - // - `projects//locations//agent` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Environment" - } - ]; - - // Optional. The maximum number of items to return in a single page. By default 100 and - // at most 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response message for [Environments.ListEnvironments][google.cloud.dialogflow.v2beta1.Environments.ListEnvironments]. -message ListEnvironmentsResponse { - // The list of agent environments. There will be a maximum number of items - // returned based on the page_size field in the request. - repeated Environment environments = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request message for [Environments.GetEnvironment][google.cloud.dialogflow.v2beta1.Environments.GetEnvironment]. -message GetEnvironmentRequest { - // Required. The name of the environment. - // Supported formats: - // - `projects//agent/environments/` - // - `projects//locations//agent/environments/` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Environment" - } - ]; -} - -// The request message for [Environments.CreateEnvironment][google.cloud.dialogflow.v2beta1.Environments.CreateEnvironment]. -message CreateEnvironmentRequest { - // Required. The agent to create an environment for. - // Supported formats: - // - `projects//agent` - // - `projects//locations//agent` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Environment" - } - ]; - - // Required. The environment to create. - Environment environment = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The unique id of the new environment. - string environment_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [Environments.UpdateEnvironment][google.cloud.dialogflow.v2beta1.Environments.UpdateEnvironment]. -message UpdateEnvironmentRequest { - // Required. The environment to update. - Environment environment = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. This field is used to prevent accidental overwrite of the draft - // environment, which is an operation that cannot be undone. To confirm that - // the caller desires this overwrite, this field must be explicitly set to - // true when updating the draft environment (environment ID = `-`). - bool allow_load_to_draft_and_discard_changes = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [Environments.DeleteEnvironment][google.cloud.dialogflow.v2beta1.Environments.DeleteEnvironment]. -message DeleteEnvironmentRequest { - // Required. The name of the environment to delete. - // / Format: - // - `projects//agent/environments/` - // - `projects//locations//agent/environments/` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Environment" - } - ]; -} - -// The request message for [Environments.GetEnvironmentHistory][google.cloud.dialogflow.v2beta1.Environments.GetEnvironmentHistory]. -message GetEnvironmentHistoryRequest { - // Required. The name of the environment to retrieve history for. - // Supported formats: - // - `projects//agent/environments/` - // - `projects//locations//agent/environments/` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Environment" - } - ]; - - // Optional. The maximum number of items to return in a single page. By default 100 and - // at most 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response message for [Environments.GetEnvironmentHistory][google.cloud.dialogflow.v2beta1.Environments.GetEnvironmentHistory]. -message EnvironmentHistory { - // Represents an environment history entry. - message Entry { - // The agent version loaded into this environment history entry. - string agent_version = 1; - - // The developer-provided description for this environment history entry. - string description = 2; - - // The creation time of this environment history entry. - google.protobuf.Timestamp create_time = 3; - } - - // Output only. The name of the environment this history is for. - // Supported formats: - // - `projects//agent/environments/` - // - `projects//locations//agent/environments/` - string parent = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The list of agent environments. There will be a maximum number of items - // returned based on the page_size field in the request. - repeated Entry entries = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/fulfillment.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/fulfillment.proto deleted file mode 100644 index d2466756..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/fulfillment.proto +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/field_mask.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "FulfillmentProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; - -// Service for managing [Fulfillments][google.cloud.dialogflow.v2beta1.Fulfillment]. -service Fulfillments { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Retrieves the fulfillment. - rpc GetFulfillment(GetFulfillmentRequest) returns (Fulfillment) { - option (google.api.http) = { - get: "/v2beta1/{name=projects/*/agent/fulfillment}" - additional_bindings { - get: "/v2beta1/{name=projects/*/locations/*/agent/fulfillment}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Updates the fulfillment. - rpc UpdateFulfillment(UpdateFulfillmentRequest) returns (Fulfillment) { - option (google.api.http) = { - patch: "/v2beta1/{fulfillment.name=projects/*/agent/fulfillment}" - body: "fulfillment" - additional_bindings { - patch: "/v2beta1/{fulfillment.name=projects/*/locations/*/agent/fulfillment}" - body: "fulfillment" - } - }; - option (google.api.method_signature) = "fulfillment,update_mask"; - } -} - -// By default, your agent responds to a matched intent with a static response. -// As an alternative, you can provide a more dynamic response by using -// fulfillment. When you enable fulfillment for an intent, Dialogflow responds -// to that intent by calling a service that you define. For example, if an -// end-user wants to schedule a haircut on Friday, your service can check your -// database and respond to the end-user with availability information for -// Friday. -// -// For more information, see the [fulfillment -// guide](https://cloud.google.com/dialogflow/docs/fulfillment-overview). -message Fulfillment { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/Fulfillment" - pattern: "projects/{project}/agent/fulfillment" - pattern: "projects/{project}/locations/{location}/agent/fulfillment" - }; - - // Represents configuration for a generic web service. - // Dialogflow supports two mechanisms for authentications: - // - Basic authentication with username and password. - // - Authentication with additional authentication headers. - // More information could be found at: - // https://cloud.google.com/dialogflow/docs/fulfillment-configure. - message GenericWebService { - // Required. The fulfillment URI for receiving POST requests. - // It must use https protocol. - string uri = 1 [(google.api.field_behavior) = REQUIRED]; - - // The user name for HTTP Basic authentication. - string username = 2; - - // The password for HTTP Basic authentication. - string password = 3; - - // The HTTP request headers to send together with fulfillment requests. - map request_headers = 4; - - // Optional. Indicates if generic web service is created through Cloud Functions - // integration. Defaults to false. - // - // is_cloud_function is deprecated. Cloud functions can be configured by - // its uri as a regular web service now. - bool is_cloud_function = 5 [ - deprecated = true, - (google.api.field_behavior) = OPTIONAL - ]; - } - - // Whether fulfillment is enabled for the specific feature. - message Feature { - // The type of the feature. - enum Type { - // Feature type not specified. - TYPE_UNSPECIFIED = 0; - - // Fulfillment is enabled for SmallTalk. - SMALLTALK = 1; - } - - // The type of the feature that enabled for fulfillment. - Type type = 1; - } - - // Required. The unique identifier of the fulfillment. - // Supported formats: - // - `projects//agent/fulfillment` - // - `projects//locations//agent/fulfillment` - // - // This field is not used for Fulfillment in an Environment. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // The human-readable name of the fulfillment, unique within the agent. - // - // This field is not used for Fulfillment in an Environment. - string display_name = 2; - - // Required. The fulfillment configuration. - oneof fulfillment { - // Configuration for a generic web service. - GenericWebService generic_web_service = 3; - } - - // Whether fulfillment is enabled. - bool enabled = 4; - - // The field defines whether the fulfillment is enabled for certain features. - repeated Feature features = 5; -} - -// The request message for [Fulfillments.GetFulfillment][google.cloud.dialogflow.v2beta1.Fulfillments.GetFulfillment]. -message GetFulfillmentRequest { - // Required. The name of the fulfillment. - // Supported formats: - // - `projects//agent/fulfillment` - // - `projects//locations//agent/fulfillment` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Fulfillment" - } - ]; -} - -// The request message for [Fulfillments.UpdateFulfillment][google.cloud.dialogflow.v2beta1.Fulfillments.UpdateFulfillment]. -message UpdateFulfillmentRequest { - // Required. The fulfillment to update. - Fulfillment fulfillment = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The mask to control which fields get updated. If the mask is not - // present, all fields will be updated. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/gcs.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/gcs.proto deleted file mode 100644 index f01ad76f..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/gcs.proto +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/api/field_behavior.proto"; -import "google/api/annotations.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "GcsProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; - -// Google Cloud Storage locations for the inputs. -message GcsSources { - // Required. Google Cloud Storage URIs for the inputs. A URI is of the - // form: - // gs://bucket/object-prefix-or-name - // Whether a prefix or name is used depends on the use case. - repeated string uris = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Google Cloud Storage location for single input. -message GcsSource { - // Required. The Google Cloud Storage URIs for the inputs. A URI is of the - // form: - // gs://bucket/object-prefix-or-name - // Whether a prefix or name is used depends on the use case. - string uri = 1; -} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto deleted file mode 100644 index d49c83ac..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/cloud/dialogflow/v2beta1/participant.proto"; -import "google/api/annotations.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "HumanAgentAssistantEventProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; - -// Output only. Represents a notification sent to Pub/Sub subscribers for -// agent assistant events in a specific conversation. -message HumanAgentAssistantEvent { - // The conversation this notification refers to. - // Format: `projects//conversations/`. - string conversation = 1; - - // The participant that the suggestion is compiled for. And This field is used - // to call [Participants.ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions] API. Format: - // `projects//conversations//participants/`. - // It will not be set in legacy workflow. - // [HumanAgentAssistantConfig.name][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.name] for more - // information. - string participant = 3; - - // The suggestion results payload that this notification refers to. It will - // only be set when - // [HumanAgentAssistantConfig.SuggestionConfig.group_suggestion_responses][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.group_suggestion_responses] - // sets to true. - repeated SuggestionResult suggestion_results = 5; -} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/intent.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/intent.proto deleted file mode 100644 index ee31c026..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/intent.proto +++ /dev/null @@ -1,1422 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dialogflow/v2beta1/audio_config.proto"; -import "google/cloud/dialogflow/v2beta1/context.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "IntentProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; - -// Service for managing [Intents][google.cloud.dialogflow.v2beta1.Intent]. -service Intents { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Returns the list of all intents in the specified agent. - rpc ListIntents(ListIntentsRequest) returns (ListIntentsResponse) { - option (google.api.http) = { - get: "/v2beta1/{parent=projects/*/agent}/intents" - additional_bindings { - get: "/v2beta1/{parent=projects/*/locations/*/agent}/intents" - } - additional_bindings { - get: "/v2beta1/{parent=projects/*/agent/environments/*}/intents" - } - additional_bindings { - get: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*}/intents" - } - }; - option (google.api.method_signature) = "parent"; - option (google.api.method_signature) = "parent,language_code"; - } - - // Retrieves the specified intent. - rpc GetIntent(GetIntentRequest) returns (Intent) { - option (google.api.http) = { - get: "/v2beta1/{name=projects/*/agent/intents/*}" - additional_bindings { - get: "/v2beta1/{name=projects/*/locations/*/agent/intents/*}" - } - }; - option (google.api.method_signature) = "name"; - option (google.api.method_signature) = "name,language_code"; - } - - // Creates an intent in the specified agent. - rpc CreateIntent(CreateIntentRequest) returns (Intent) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*/agent}/intents" - body: "intent" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/agent}/intents" - body: "intent" - } - }; - option (google.api.method_signature) = "parent,intent"; - option (google.api.method_signature) = "parent,intent,language_code"; - } - - // Updates the specified intent. - rpc UpdateIntent(UpdateIntentRequest) returns (Intent) { - option (google.api.http) = { - patch: "/v2beta1/{intent.name=projects/*/agent/intents/*}" - body: "intent" - additional_bindings { - patch: "/v2beta1/{intent.name=projects/*/locations/*/agent/intents/*}" - body: "intent" - } - }; - option (google.api.method_signature) = "intent,update_mask"; - option (google.api.method_signature) = "intent"; - option (google.api.method_signature) = "intent,language_code"; - option (google.api.method_signature) = "intent,language_code,update_mask"; - } - - // Deletes the specified intent and its direct or indirect followup intents. - rpc DeleteIntent(DeleteIntentRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2beta1/{name=projects/*/agent/intents/*}" - additional_bindings { - delete: "/v2beta1/{name=projects/*/locations/*/agent/intents/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Updates/Creates multiple intents in the specified agent. - // - // Operation - rpc BatchUpdateIntents(BatchUpdateIntentsRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*/agent}/intents:batchUpdate" - body: "*" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/agent}/intents:batchUpdate" - body: "*" - } - }; - option (google.api.method_signature) = "parent,intent_batch_uri"; - option (google.api.method_signature) = "parent,intent_batch_inline"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse" - metadata_type: "google.protobuf.Struct" - }; - } - - // Deletes intents in the specified agent. - // - // Operation - rpc BatchDeleteIntents(BatchDeleteIntentsRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*/agent}/intents:batchDelete" - body: "*" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/agent}/intents:batchDelete" - body: "*" - } - }; - option (google.api.method_signature) = "parent,intents"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Struct" - }; - } -} - -// An intent categorizes an end-user's intention for one conversation turn. For -// each agent, you define many intents, where your combined intents can handle a -// complete conversation. When an end-user writes or says something, referred to -// as an end-user expression or end-user input, Dialogflow matches the end-user -// input to the best intent in your agent. Matching an intent is also known as -// intent classification. -// -// For more information, see the [intent -// guide](https://cloud.google.com/dialogflow/docs/intents-overview). -message Intent { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/Intent" - pattern: "projects/{project}/agent/intents/{intent}" - pattern: "projects/{project}/locations/{location}/agent/intents/{intent}" - }; - - // Represents an example that the agent is trained on. - message TrainingPhrase { - // Represents a part of a training phrase. - message Part { - // Required. The text for this part. - string text = 1; - - // Optional. The entity type name prefixed with `@`. - // This field is required for annotated parts of the training phrase. - string entity_type = 2; - - // Optional. The parameter name for the value extracted from the - // annotated part of the example. - // This field is required for annotated parts of the training phrase. - string alias = 3; - - // Optional. Indicates whether the text was manually annotated. - // This field is set to true when the Dialogflow Console is used to - // manually annotate the part. When creating an annotated part with the - // API, you must set this to true. - bool user_defined = 4; - } - - // Represents different types of training phrases. - enum Type { - // Not specified. This value should never be used. - TYPE_UNSPECIFIED = 0; - - // Examples do not contain @-prefixed entity type names, but example parts - // can be annotated with entity types. - EXAMPLE = 1; - - // Templates are not annotated with entity types, but they can contain - // @-prefixed entity type names as substrings. - // Template mode has been deprecated. Example mode is the only supported - // way to create new training phrases. If you have existing training - // phrases that you've created in template mode, those will continue to - // work. - TEMPLATE = 2 [deprecated = true]; - } - - // Output only. The unique identifier of this training phrase. - string name = 1; - - // Required. The type of the training phrase. - Type type = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ordered list of training phrase parts. - // The parts are concatenated in order to form the training phrase. - // - // Note: The API does not automatically annotate training phrases like the - // Dialogflow Console does. - // - // Note: Do not forget to include whitespace at part boundaries, - // so the training phrase is well formatted when the parts are concatenated. - // - // If the training phrase does not need to be annotated with parameters, - // you just need a single part with only the [Part.text][google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part.text] field set. - // - // If you want to annotate the training phrase, you must create multiple - // parts, where the fields of each part are populated in one of two ways: - // - // - `Part.text` is set to a part of the phrase that has no parameters. - // - `Part.text` is set to a part of the phrase that you want to annotate, - // and the `entity_type`, `alias`, and `user_defined` fields are all - // set. - repeated Part parts = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Indicates how many times this example was added to - // the intent. Each time a developer adds an existing sample by editing an - // intent or training, this counter is increased. - int32 times_added_count = 4 [(google.api.field_behavior) = OPTIONAL]; - } - - // Represents intent parameters. - message Parameter { - // The unique identifier of this parameter. - string name = 1; - - // Required. The name of the parameter. - string display_name = 2; - - // Optional. The definition of the parameter value. It can be: - // - // - a constant string, - // - a parameter value defined as `$parameter_name`, - // - an original parameter value defined as `$parameter_name.original`, - // - a parameter value from some context defined as - // `#context_name.parameter_name`. - string value = 3; - - // Optional. The default value to use when the `value` yields an empty - // result. - // Default values can be extracted from contexts by using the following - // syntax: `#context_name.parameter_name`. - string default_value = 4; - - // Optional. The name of the entity type, prefixed with `@`, that - // describes values of the parameter. If the parameter is - // required, this must be provided. - string entity_type_display_name = 5; - - // Optional. Indicates whether the parameter is required. That is, - // whether the intent cannot be completed without collecting the parameter - // value. - bool mandatory = 6; - - // Optional. The collection of prompts that the agent can present to the - // user in order to collect a value for the parameter. - repeated string prompts = 7; - - // Optional. Indicates whether the parameter represents a list of values. - bool is_list = 8; - } - - // Corresponds to the `Response` field in the Dialogflow console. - message Message { - // The text response message. - message Text { - // Optional. The collection of the agent's responses. - repeated string text = 1; - } - - // The image response message. - message Image { - // Optional. The public URI to an image file. - string image_uri = 1; - - // A text description of the image to be used for accessibility, - // e.g., screen readers. Required if image_uri is set for CarouselSelect. - string accessibility_text = 2; - } - - // The quick replies response message. - message QuickReplies { - // Optional. The title of the collection of quick replies. - string title = 1; - - // Optional. The collection of quick replies. - repeated string quick_replies = 2; - } - - // The card response message. - message Card { - // Optional. Contains information about a button. - message Button { - // Optional. The text to show on the button. - string text = 1; - - // Optional. The text to send back to the Dialogflow API or a URI to - // open. - string postback = 2; - } - - // Optional. The title of the card. - string title = 1; - - // Optional. The subtitle of the card. - string subtitle = 2; - - // Optional. The public URI to an image file for the card. - string image_uri = 3; - - // Optional. The collection of card buttons. - repeated Button buttons = 4; - } - - // The simple response message containing speech or text. - message SimpleResponse { - // One of text_to_speech or ssml must be provided. The plain text of the - // speech output. Mutually exclusive with ssml. - string text_to_speech = 1; - - // One of text_to_speech or ssml must be provided. Structured spoken - // response to the user in the SSML format. Mutually exclusive with - // text_to_speech. - string ssml = 2; - - // Optional. The text to display. - string display_text = 3; - } - - // The collection of simple response candidates. - // This message in `QueryResult.fulfillment_messages` and - // `WebhookResponse.fulfillment_messages` should contain only one - // `SimpleResponse`. - message SimpleResponses { - // Required. The list of simple responses. - repeated SimpleResponse simple_responses = 1; - } - - // The basic card message. Useful for displaying information. - message BasicCard { - // The button object that appears at the bottom of a card. - message Button { - // Opens the given URI. - message OpenUriAction { - // Required. The HTTP or HTTPS scheme URI. - string uri = 1; - } - - // Required. The title of the button. - string title = 1; - - // Required. Action to take when a user taps on the button. - OpenUriAction open_uri_action = 2; - } - - // Optional. The title of the card. - string title = 1; - - // Optional. The subtitle of the card. - string subtitle = 2; - - // Required, unless image is present. The body text of the card. - string formatted_text = 3; - - // Optional. The image for the card. - Image image = 4; - - // Optional. The collection of card buttons. - repeated Button buttons = 5; - } - - // The suggestion chip message that the user can tap to quickly post a reply - // to the conversation. - message Suggestion { - // Required. The text shown the in the suggestion chip. - string title = 1; - } - - // The collection of suggestions. - message Suggestions { - // Required. The list of suggested replies. - repeated Suggestion suggestions = 1; - } - - // The suggestion chip message that allows the user to jump out to the app - // or website associated with this agent. - message LinkOutSuggestion { - // Required. The name of the app or site this chip is linking to. - string destination_name = 1; - - // Required. The URI of the app or site to open when the user taps the - // suggestion chip. - string uri = 2; - } - - // The card for presenting a list of options to select from. - message ListSelect { - // An item in the list. - message Item { - // Required. Additional information about this option. - SelectItemInfo info = 1; - - // Required. The title of the list item. - string title = 2; - - // Optional. The main text describing the item. - string description = 3; - - // Optional. The image to display. - Image image = 4; - } - - // Optional. The overall title of the list. - string title = 1; - - // Required. List items. - repeated Item items = 2; - - // Optional. Subtitle of the list. - string subtitle = 3 [(google.api.field_behavior) = OPTIONAL]; - } - - // The card for presenting a carousel of options to select from. - message CarouselSelect { - // An item in the carousel. - message Item { - // Required. Additional info about the option item. - SelectItemInfo info = 1; - - // Required. Title of the carousel item. - string title = 2; - - // Optional. The body text of the card. - string description = 3; - - // Optional. The image to display. - Image image = 4; - } - - // Required. Carousel items. - repeated Item items = 1; - } - - // Additional info about the select item for when it is triggered in a - // dialog. - message SelectItemInfo { - // Required. A unique key that will be sent back to the agent if this - // response is given. - string key = 1; - - // Optional. A list of synonyms that can also be used to trigger this - // item in dialog. - repeated string synonyms = 2; - } - - // Plays audio from a file in Telephony Gateway. - message TelephonyPlayAudio { - // Required. URI to a Google Cloud Storage object containing the audio to - // play, e.g., "gs://bucket/object". The object must contain a single - // channel (mono) of linear PCM audio (2 bytes / sample) at 8kHz. - // - // This object must be readable by the `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` service account - // where is the number of the Telephony Gateway project - // (usually the same as the Dialogflow agent project). If the Google Cloud - // Storage bucket is in the Telephony Gateway project, this permission is - // added by default when enabling the Dialogflow V2 API. - // - // For audio from other sources, consider using the - // `TelephonySynthesizeSpeech` message with SSML. - string audio_uri = 1; - } - - // Synthesizes speech and plays back the synthesized audio to the caller in - // Telephony Gateway. - // - // Telephony Gateway takes the synthesizer settings from - // `DetectIntentResponse.output_audio_config` which can either be set - // at request-level or can come from the agent-level synthesizer config. - message TelephonySynthesizeSpeech { - // Required. The source to be synthesized. - oneof source { - // The raw text to be synthesized. - string text = 1; - - // The SSML to be synthesized. For more information, see - // [SSML](https://developers.google.com/actions/reference/ssml). - string ssml = 2; - } - } - - // Transfers the call in Telephony Gateway. - message TelephonyTransferCall { - // Required. The phone number to transfer the call to - // in [E.164 format](https://en.wikipedia.org/wiki/E.164). - // - // We currently only allow transferring to US numbers (+1xxxyyyzzzz). - string phone_number = 1; - } - - // Rich Business Messaging (RBM) text response with suggestions. - message RbmText { - // Required. Text sent and displayed to the user. - string text = 1; - - // Optional. One or more suggestions to show to the user. - repeated RbmSuggestion rbm_suggestion = 2; - } - - // Carousel Rich Business Messaging (RBM) rich card. - // - // Rich cards allow you to respond to users with more vivid content, e.g. - // with media and suggestions. - // - // If you want to show a single card with more control over the layout, - // please use [RbmStandaloneCard][google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard] instead. - message RbmCarouselCard { - // The width of the cards in the carousel. - enum CardWidth { - // Not specified. - CARD_WIDTH_UNSPECIFIED = 0; - - // 120 DP. Note that tall media cannot be used. - SMALL = 1; - - // 232 DP. - MEDIUM = 2; - } - - // Required. The width of the cards in the carousel. - CardWidth card_width = 1; - - // Required. The cards in the carousel. A carousel must have at least - // 2 cards and at most 10. - repeated RbmCardContent card_contents = 2; - } - - // Standalone Rich Business Messaging (RBM) rich card. - // - // Rich cards allow you to respond to users with more vivid content, e.g. - // with media and suggestions. - // - // You can group multiple rich cards into one using [RbmCarouselCard][google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard] but - // carousel cards will give you less control over the card layout. - message RbmStandaloneCard { - // Orientation of the card. - enum CardOrientation { - // Not specified. - CARD_ORIENTATION_UNSPECIFIED = 0; - - // Horizontal layout. - HORIZONTAL = 1; - - // Vertical layout. - VERTICAL = 2; - } - - // Thumbnail preview alignment for standalone cards with horizontal - // layout. - enum ThumbnailImageAlignment { - // Not specified. - THUMBNAIL_IMAGE_ALIGNMENT_UNSPECIFIED = 0; - - // Thumbnail preview is left-aligned. - LEFT = 1; - - // Thumbnail preview is right-aligned. - RIGHT = 2; - } - - // Required. Orientation of the card. - CardOrientation card_orientation = 1; - - // Required if orientation is horizontal. - // Image preview alignment for standalone cards with horizontal layout. - ThumbnailImageAlignment thumbnail_image_alignment = 2; - - // Required. Card content. - RbmCardContent card_content = 3; - } - - // Rich Business Messaging (RBM) Card content - message RbmCardContent { - // Rich Business Messaging (RBM) Media displayed in Cards - // The following media-types are currently supported: - // - // Image Types - // - // * image/jpeg - // * image/jpg' - // * image/gif - // * image/png - // - // Video Types - // - // * video/h263 - // * video/m4v - // * video/mp4 - // * video/mpeg - // * video/mpeg4 - // * video/webm - message RbmMedia { - // Media height - enum Height { - // Not specified. - HEIGHT_UNSPECIFIED = 0; - - // 112 DP. - SHORT = 1; - - // 168 DP. - MEDIUM = 2; - - // 264 DP. Not available for rich card carousels when the card width - // is set to small. - TALL = 3; - } - - // Required. Publicly reachable URI of the file. The RBM platform - // determines the MIME type of the file from the content-type field in - // the HTTP headers when the platform fetches the file. The content-type - // field must be present and accurate in the HTTP response from the URL. - string file_uri = 1; - - // Optional. Publicly reachable URI of the thumbnail.If you don't - // provide a thumbnail URI, the RBM platform displays a blank - // placeholder thumbnail until the user's device downloads the file. - // Depending on the user's setting, the file may not download - // automatically and may require the user to tap a download button. - string thumbnail_uri = 2; - - // Required for cards with vertical orientation. The height of the media - // within a rich card with a vertical layout. - // For a standalone card with horizontal layout, height is not - // customizable, and this field is ignored. - Height height = 3; - } - - // Optional. Title of the card (at most 200 bytes). - // - // At least one of the title, description or media must be set. - string title = 1; - - // Optional. Description of the card (at most 2000 bytes). - // - // At least one of the title, description or media must be set. - string description = 2; - - // Optional. However at least one of the title, description or media must - // be set. Media (image, GIF or a video) to include in the card. - RbmMedia media = 3; - - // Optional. List of suggestions to include in the card. - repeated RbmSuggestion suggestions = 4; - } - - // Rich Business Messaging (RBM) suggestion. Suggestions allow user to - // easily select/click a predefined response or perform an action (like - // opening a web uri). - message RbmSuggestion { - // Predefined suggested response or action for user to choose - oneof suggestion { - // Predefined replies for user to select instead of typing - RbmSuggestedReply reply = 1; - - // Predefined client side actions that user can choose - RbmSuggestedAction action = 2; - } - } - - // Rich Business Messaging (RBM) suggested reply that the user can click - // instead of typing in their own response. - message RbmSuggestedReply { - // Suggested reply text. - string text = 1; - - // Opaque payload that the Dialogflow receives in a user event - // when the user taps the suggested reply. This data will be also - // forwarded to webhook to allow performing custom business logic. - string postback_data = 2; - } - - // Rich Business Messaging (RBM) suggested client-side action that the user - // can choose from the card. - message RbmSuggestedAction { - // Opens the user's default dialer app with the specified phone number - // but does not dial automatically. - message RbmSuggestedActionDial { - // Required. The phone number to fill in the default dialer app. - // This field should be in [E.164](https://en.wikipedia.org/wiki/E.164) - // format. An example of a correctly formatted phone number: - // +15556767888. - string phone_number = 1; - } - - // Opens the user's default web browser app to the specified uri - // If the user has an app installed that is - // registered as the default handler for the URL, then this app will be - // opened instead, and its icon will be used in the suggested action UI. - message RbmSuggestedActionOpenUri { - // Required. The uri to open on the user device - string uri = 1; - } - - // Opens the device's location chooser so the user can pick a location - // to send back to the agent. - message RbmSuggestedActionShareLocation { - - } - - // Text to display alongside the action. - string text = 1; - - // Opaque payload that the Dialogflow receives in a user event - // when the user taps the suggested action. This data will be also - // forwarded to webhook to allow performing custom business logic. - string postback_data = 2; - - // Action that needs to be triggered. - oneof action { - // Suggested client side action: Dial a phone number - RbmSuggestedActionDial dial = 3; - - // Suggested client side action: Open a URI on device - RbmSuggestedActionOpenUri open_url = 4; - - // Suggested client side action: Share user location - RbmSuggestedActionShareLocation share_location = 5; - } - } - - // The media content card for Actions on Google. - message MediaContent { - // Response media object for media content card. - message ResponseMediaObject { - // Required. Name of media card. - string name = 1; - - // Optional. Description of media card. - string description = 2; - - // Image to show with the media card. - oneof image { - // Optional. Image to display above media content. - Image large_image = 3; - - // Optional. Icon to display above media content. - Image icon = 4; - } - - // Required. Url where the media is stored. - string content_url = 5; - } - - // Format of response media type. - enum ResponseMediaType { - // Unspecified. - RESPONSE_MEDIA_TYPE_UNSPECIFIED = 0; - - // Response media type is audio. - AUDIO = 1; - } - - // Optional. What type of media is the content (ie "audio"). - ResponseMediaType media_type = 1; - - // Required. List of media objects. - repeated ResponseMediaObject media_objects = 2; - } - - // Browse Carousel Card for Actions on Google. - // https://developers.google.com/actions/assistant/responses#browsing_carousel - message BrowseCarouselCard { - // Browsing carousel tile - message BrowseCarouselCardItem { - // Actions on Google action to open a given url. - message OpenUrlAction { - // Type of the URI. - enum UrlTypeHint { - // Unspecified - URL_TYPE_HINT_UNSPECIFIED = 0; - - // Url would be an amp action - AMP_ACTION = 1; - - // URL that points directly to AMP content, or to a canonical URL - // which refers to AMP content via . - AMP_CONTENT = 2; - } - - // Required. URL - string url = 1; - - // Optional. Specifies the type of viewer that is used when opening - // the URL. Defaults to opening via web browser. - UrlTypeHint url_type_hint = 3; - } - - // Required. Action to present to the user. - OpenUrlAction open_uri_action = 1; - - // Required. Title of the carousel item. Maximum of two lines of text. - string title = 2; - - // Optional. Description of the carousel item. Maximum of four lines of - // text. - string description = 3; - - // Optional. Hero image for the carousel item. - Image image = 4; - - // Optional. Text that appears at the bottom of the Browse Carousel - // Card. Maximum of one line of text. - string footer = 5; - } - - // Image display options for Actions on Google. This should be used for - // when the image's aspect ratio does not match the image container's - // aspect ratio. - enum ImageDisplayOptions { - // Fill the gaps between the image and the image container with gray - // bars. - IMAGE_DISPLAY_OPTIONS_UNSPECIFIED = 0; - - // Fill the gaps between the image and the image container with gray - // bars. - GRAY = 1; - - // Fill the gaps between the image and the image container with white - // bars. - WHITE = 2; - - // Image is scaled such that the image width and height match or exceed - // the container dimensions. This may crop the top and bottom of the - // image if the scaled image height is greater than the container - // height, or crop the left and right of the image if the scaled image - // width is greater than the container width. This is similar to "Zoom - // Mode" on a widescreen TV when playing a 4:3 video. - CROPPED = 3; - - // Pad the gaps between image and image frame with a blurred copy of the - // same image. - BLURRED_BACKGROUND = 4; - } - - // Required. List of items in the Browse Carousel Card. Minimum of two - // items, maximum of ten. - repeated BrowseCarouselCardItem items = 1; - - // Optional. Settings for displaying the image. Applies to every image in - // [items][google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.items]. - ImageDisplayOptions image_display_options = 2; - } - - // Table card for Actions on Google. - message TableCard { - // Required. Title of the card. - string title = 1; - - // Optional. Subtitle to the title. - string subtitle = 2; - - // Optional. Image which should be displayed on the card. - Image image = 3; - - // Optional. Display properties for the columns in this table. - repeated ColumnProperties column_properties = 4; - - // Optional. Rows in this table of data. - repeated TableCardRow rows = 5; - - // Optional. List of buttons for the card. - repeated BasicCard.Button buttons = 6; - } - - // Column properties for [TableCard][google.cloud.dialogflow.v2beta1.Intent.Message.TableCard]. - message ColumnProperties { - // Text alignments within a cell. - enum HorizontalAlignment { - // Text is aligned to the leading edge of the column. - HORIZONTAL_ALIGNMENT_UNSPECIFIED = 0; - - // Text is aligned to the leading edge of the column. - LEADING = 1; - - // Text is centered in the column. - CENTER = 2; - - // Text is aligned to the trailing edge of the column. - TRAILING = 3; - } - - // Required. Column heading. - string header = 1; - - // Optional. Defines text alignment for all cells in this column. - HorizontalAlignment horizontal_alignment = 2; - } - - // Row of [TableCard][google.cloud.dialogflow.v2beta1.Intent.Message.TableCard]. - message TableCardRow { - // Optional. List of cells that make up this row. - repeated TableCardCell cells = 1; - - // Optional. Whether to add a visual divider after this row. - bool divider_after = 2; - } - - // Cell of [TableCardRow][google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow]. - message TableCardCell { - // Required. Text in this cell. - string text = 1; - } - - // Represents different platforms that a rich message can be intended for. - enum Platform { - // Not specified. - PLATFORM_UNSPECIFIED = 0; - - // Facebook. - FACEBOOK = 1; - - // Slack. - SLACK = 2; - - // Telegram. - TELEGRAM = 3; - - // Kik. - KIK = 4; - - // Skype. - SKYPE = 5; - - // Line. - LINE = 6; - - // Viber. - VIBER = 7; - - // Google Assistant - // See [Dialogflow webhook - // format](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json) - ACTIONS_ON_GOOGLE = 8; - - // Telephony Gateway. - TELEPHONY = 10; - - // Google Hangouts. - GOOGLE_HANGOUTS = 11; - } - - // Required. The rich response message. - oneof message { - // Returns a text response. - Text text = 1; - - // Displays an image. - Image image = 2; - - // Displays quick replies. - QuickReplies quick_replies = 3; - - // Displays a card. - Card card = 4; - - // A custom platform-specific response. - google.protobuf.Struct payload = 5; - - // Returns a voice or text-only response for Actions on Google. - SimpleResponses simple_responses = 7; - - // Displays a basic card for Actions on Google. - BasicCard basic_card = 8; - - // Displays suggestion chips for Actions on Google. - Suggestions suggestions = 9; - - // Displays a link out suggestion chip for Actions on Google. - LinkOutSuggestion link_out_suggestion = 10; - - // Displays a list card for Actions on Google. - ListSelect list_select = 11; - - // Displays a carousel card for Actions on Google. - CarouselSelect carousel_select = 12; - - // Plays audio from a file in Telephony Gateway. - TelephonyPlayAudio telephony_play_audio = 13; - - // Synthesizes speech in Telephony Gateway. - TelephonySynthesizeSpeech telephony_synthesize_speech = 14; - - // Transfers the call in Telephony Gateway. - TelephonyTransferCall telephony_transfer_call = 15; - - // Rich Business Messaging (RBM) text response. - // - // RBM allows businesses to send enriched and branded versions of SMS. See - // https://jibe.google.com/business-messaging. - RbmText rbm_text = 18; - - // Standalone Rich Business Messaging (RBM) rich card response. - RbmStandaloneCard rbm_standalone_rich_card = 19; - - // Rich Business Messaging (RBM) carousel rich card response. - RbmCarouselCard rbm_carousel_rich_card = 20; - - // Browse carousel card for Actions on Google. - BrowseCarouselCard browse_carousel_card = 22; - - // Table card for Actions on Google. - TableCard table_card = 23; - - // The media content card for Actions on Google. - MediaContent media_content = 24; - } - - // Optional. The platform that this message is intended for. - Platform platform = 6 [(google.api.field_behavior) = OPTIONAL]; - } - - // Represents a single followup intent in the chain. - message FollowupIntentInfo { - // The unique identifier of the followup intent. - // Format: `projects//agent/intents/`. - string followup_intent_name = 1; - - // The unique identifier of the followup intent's parent. - // Format: `projects//agent/intents/`. - string parent_followup_intent_name = 2; - } - - // Represents the different states that webhooks can be in. - enum WebhookState { - // Webhook is disabled in the agent and in the intent. - WEBHOOK_STATE_UNSPECIFIED = 0; - - // Webhook is enabled in the agent and in the intent. - WEBHOOK_STATE_ENABLED = 1; - - // Webhook is enabled in the agent and in the intent. Also, each slot - // filling prompt is forwarded to the webhook. - WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING = 2; - } - - // Optional. The unique identifier of this intent. - // Required for [Intents.UpdateIntent][google.cloud.dialogflow.v2beta1.Intents.UpdateIntent] and [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents] - // methods. - // Supported formats: - // - // - `projects//agent/intents/` - // - `projects//locations//agent/intents/` - string name = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The name of this intent. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Indicates whether webhooks are enabled for the intent. - WebhookState webhook_state = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The priority of this intent. Higher numbers represent higher - // priorities. - // - // - If the supplied value is unspecified or 0, the service - // translates the value to 500,000, which corresponds to the - // `Normal` priority in the console. - // - If the supplied value is negative, the intent is ignored - // in runtime detect intent requests. - int32 priority = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates whether this is a fallback intent. - bool is_fallback = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates whether Machine Learning is enabled for the intent. - // Note: If `ml_enabled` setting is set to false, then this intent is not - // taken into account during inference in `ML ONLY` match mode. Also, - // auto-markup in the UI is turned off. - // DEPRECATED! Please use `ml_disabled` field instead. - // NOTE: If both `ml_enabled` and `ml_disabled` are either not set or false, - // then the default value is determined as follows: - // - // - Before April 15th, 2018 the default is: - // ml_enabled = false / ml_disabled = true. - // - After April 15th, 2018 the default is: - // ml_enabled = true / ml_disabled = false. - bool ml_enabled = 5 [ - deprecated = true, - (google.api.field_behavior) = OPTIONAL - ]; - - // Optional. Indicates whether Machine Learning is disabled for the intent. - // Note: If `ml_disabled` setting is set to true, then this intent is not - // taken into account during inference in `ML ONLY` match mode. Also, - // auto-markup in the UI is turned off. - bool ml_disabled = 19 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates that a live agent should be brought in to handle the - // interaction with the user. In most cases, when you set this flag to true, - // you would also want to set end_interaction to true as well. Default is - // false. - bool live_agent_handoff = 20 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates that this intent ends an interaction. Some integrations - // (e.g., Actions on Google or Dialogflow phone gateway) use this information - // to close interaction with an end user. Default is false. - bool end_interaction = 21 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The list of context names required for this intent to be - // triggered. - // Formats: - // - // - `projects//agent/sessions/-/contexts/` - // - `projects//locations//agent/sessions/-/contexts/` - repeated string input_context_names = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The collection of event names that trigger the intent. - // If the collection of input contexts is not empty, all of the contexts must - // be present in the active user session for an event to trigger this intent. - // Event names are limited to 150 characters. - repeated string events = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The collection of examples that the agent is - // trained on. - repeated TrainingPhrase training_phrases = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The name of the action associated with the intent. - // Note: The action name must not contain whitespaces. - string action = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The collection of contexts that are activated when the intent - // is matched. Context messages in this collection should not set the - // parameters field. Setting the `lifespan_count` to 0 will reset the context - // when the intent is matched. - // Format: `projects//agent/sessions/-/contexts/`. - repeated Context output_contexts = 11 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates whether to delete all contexts in the current - // session when this intent is matched. - bool reset_contexts = 12 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The collection of parameters associated with the intent. - repeated Parameter parameters = 13 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The collection of rich messages corresponding to the - // `Response` field in the Dialogflow console. - repeated Message messages = 14; - - // Optional. The list of platforms for which the first responses will be - // copied from the messages in PLATFORM_UNSPECIFIED (i.e. default platform). - repeated Message.Platform default_response_platforms = 15 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The unique identifier of the root intent in the chain of - // followup intents. It identifies the correct followup intents chain for - // this intent. - // - // Format: `projects//agent/intents/`. - string root_followup_intent_name = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The unique identifier of the parent intent in the - // chain of followup intents. You can set this field when creating an intent, - // for example with [CreateIntent][google.cloud.dialogflow.v2beta1.Intents.CreateIntent] or - // [BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents], in order to make this - // intent a followup intent. - // - // It identifies the parent followup intent. - // Format: `projects//agent/intents/`. - string parent_followup_intent_name = 17 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Information about all followup intents that have this intent as - // a direct or indirect parent. We populate this field only in the output. - repeated FollowupIntentInfo followup_intent_info = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The request message for [Intents.ListIntents][google.cloud.dialogflow.v2beta1.Intents.ListIntents]. -message ListIntentsRequest { - // Required. The agent to list all intents from. - // Format: `projects//agent` or `projects//locations//agent`. - // - // Alternatively, you can specify the environment to list intents for. - // Format: `projects//agent/environments/` - // or `projects//locations//agent/environments/`. - // Note: training phrases of the intents will not be returned for non-draft - // environment. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Intent" - } - ]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The resource view to apply to the returned intent. - IntentView intent_view = 3; - - // Optional. The maximum number of items to return in a single page. By - // default 100 and at most 1000. - int32 page_size = 4; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 5; -} - -// The response message for [Intents.ListIntents][google.cloud.dialogflow.v2beta1.Intents.ListIntents]. -message ListIntentsResponse { - // The list of agent intents. There will be a maximum number of items - // returned based on the page_size field in the request. - repeated Intent intents = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request message for [Intents.GetIntent][google.cloud.dialogflow.v2beta1.Intents.GetIntent]. -message GetIntentRequest { - // Required. The name of the intent. - // Supported formats: - // - // - `projects//agent/intents/` - // - `projects//locations//agent/intents/` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Intent" - } - ]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The resource view to apply to the returned intent. - IntentView intent_view = 3; -} - -// The request message for [Intents.CreateIntent][google.cloud.dialogflow.v2beta1.Intents.CreateIntent]. -message CreateIntentRequest { - // Required. The agent to create a intent for. - // Supported formats: - // - // - `projects//agent` - // - `projects//locations//agent` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Intent" - } - ]; - - // Required. The intent to create. - Intent intent = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The resource view to apply to the returned intent. - IntentView intent_view = 4; -} - -// The request message for [Intents.UpdateIntent][google.cloud.dialogflow.v2beta1.Intents.UpdateIntent]. -message UpdateIntentRequest { - // Required. The intent to update. - Intent intent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 3; - - // Optional. The resource view to apply to the returned intent. - IntentView intent_view = 4; -} - -// The request message for [Intents.DeleteIntent][google.cloud.dialogflow.v2beta1.Intents.DeleteIntent]. -message DeleteIntentRequest { - // Required. The name of the intent to delete. If this intent has direct or - // indirect followup intents, we also delete them. - // - // Supported formats: - // - // - `projects//agent/intents/` - // - `projects//locations//agent/intents/` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Intent" - } - ]; -} - -// The request message for [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents]. -message BatchUpdateIntentsRequest { - // Required. The name of the agent to update or create intents in. - // Supported formats: - // - // - `projects//agent` - // - `projects//locations//agent` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Intent" - } - ]; - - // Required. The source of the intent batch. - // - // For each intent in the batch: - // - // * If `name` is specified, we update an existing intent. - // * If `name` is not specified, we create a new intent. - oneof intent_batch { - // The URI to a Google Cloud Storage file containing intents to update or - // create. The file format can either be a serialized proto (of IntentBatch - // type) or JSON object. Note: The URI must start with "gs://". - string intent_batch_uri = 2; - - // The collection of intents to update or create. - IntentBatch intent_batch_inline = 3; - } - - // Optional. The language used to access language-specific data. - // If not specified, the agent's default language is used. - // For more information, see - // [Multilingual intent and entity - // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - string language_code = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 5; - - // Optional. The resource view to apply to the returned intent. - IntentView intent_view = 6; -} - -// The response message for [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents]. -message BatchUpdateIntentsResponse { - // The collection of updated or created intents. - repeated Intent intents = 1; -} - -// The request message for [Intents.BatchDeleteIntents][google.cloud.dialogflow.v2beta1.Intents.BatchDeleteIntents]. -message BatchDeleteIntentsRequest { - // Required. The name of the agent to delete all entities types for. - // Supported formats: - // - // - `projects//agent` - // - `projects//locations//agent` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Intent" - } - ]; - - // Required. The collection of intents to delete. Only intent `name` must be - // filled in. - repeated Intent intents = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// This message is a wrapper around a collection of intents. -message IntentBatch { - // A collection of intents. - repeated Intent intents = 1; -} - -// Represents the options for views of an intent. -// An intent can be a sizable object. Therefore, we provide a resource view that -// does not return training phrases in the response by default. -enum IntentView { - // Training phrases field is not populated in the response. - INTENT_VIEW_UNSPECIFIED = 0; - - // All fields are populated. - INTENT_VIEW_FULL = 1; -} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto deleted file mode 100644 index fe50073b..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto +++ /dev/null @@ -1,278 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "KnowledgeBaseProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; - -// Service for managing [KnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBase]. -service KnowledgeBases { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Returns the list of all knowledge bases of the specified agent. - // - // Note: The `projects.agent.knowledgeBases` resource is deprecated; - // only use `projects.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" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves the specified knowledge base. - // - // Note: The `projects.agent.knowledgeBases` resource is deprecated; - // only use `projects.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/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a knowledge base. - // - // Note: The `projects.agent.knowledgeBases` resource is deprecated; - // only use `projects.knowledgeBases`. - rpc CreateKnowledgeBase(CreateKnowledgeBaseRequest) returns (KnowledgeBase) { - 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" - } - }; - option (google.api.method_signature) = "parent,knowledge_base"; - } - - // Deletes the specified knowledge base. - // - // Note: The `projects.agent.knowledgeBases` resource is deprecated; - // only use `projects.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/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Updates the specified knowledge base. - // - // Note: The `projects.agent.knowledgeBases` resource is deprecated; - // only use `projects.knowledgeBases`. - rpc UpdateKnowledgeBase(UpdateKnowledgeBaseRequest) returns (KnowledgeBase) { - 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" - } - }; - option (google.api.method_signature) = "knowledge_base,update_mask"; - option (google.api.method_signature) = "knowledge_base"; - } -} - -// A knowledge base represents a collection of knowledge documents that you -// provide to Dialogflow. Your knowledge documents contain information that may -// be useful during conversations with end-users. Some Dialogflow features use -// knowledge bases when looking for a response to an end-user input. -// -// For more information, see the [knowledge base -// guide](https://cloud.google.com/dialogflow/docs/how/knowledge-bases). -// -// Note: The `projects.agent.knowledgeBases` resource is deprecated; -// only use `projects.knowledgeBases`. -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//locations//knowledgeBases/`. - string name = 1; - - // Required. The display name of the knowledge base. The name must be 1024 - // bytes or less; otherwise, the creation request fails. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Language which represents the KnowledgeBase. When the KnowledgeBase is - // created/updated, this is populated for all non en-us languages. If not - // populated, the default language en-us applies. - string language_code = 4; -} - -// Request message for [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases]. -message ListKnowledgeBasesRequest { - // Required. The project to list of knowledge bases for. - // Format: `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/KnowledgeBase" - } - ]; - - // The maximum number of items to return in a single page. By - // default 10 and at most 100. - int32 page_size = 2; - - // The next_page_token value returned from a previous list request. - string page_token = 3; - - // The filter expression used to filter knowledge bases returned by the list - // method. The expression has the following syntax: - // - // [AND ] ... - // - // The following fields and operators are supported: - // - // * display_name with has(:) operator - // * language_code with equals(=) operator - // - // Examples: - // - // * 'language_code=en-us' matches knowledge bases with en-us language code. - // * 'display_name:articles' matches knowledge bases whose display name - // contains "articles". - // * 'display_name:"Best Articles"' matches knowledge bases whose display - // name contains "Best Articles". - // * 'language_code=en-gb AND display_name=articles' matches all knowledge - // bases whose display name contains "articles" and whose language code is - // "en-gb". - // - // Note: An empty filter string (i.e. "") is a no-op and will result in no - // filtering. - // - // For more information about filtering, see - // [API Filtering](https://aip.dev/160). - string filter = 4; -} - -// Response message for [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases]. -message ListKnowledgeBasesResponse { - // The list of knowledge bases. - repeated KnowledgeBase knowledge_bases = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// Request message for [KnowledgeBases.GetKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.GetKnowledgeBase]. -message GetKnowledgeBaseRequest { - // Required. The name of the knowledge base to retrieve. - // Format `projects//locations//knowledgeBases/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/KnowledgeBase" - } - ]; -} - -// Request message for [KnowledgeBases.CreateKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.CreateKnowledgeBase]. -message CreateKnowledgeBaseRequest { - // Required. The project to create a knowledge base for. - // Format: `projects//locations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/KnowledgeBase" - } - ]; - - // Required. The knowledge base to create. - KnowledgeBase knowledge_base = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for [KnowledgeBases.DeleteKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.DeleteKnowledgeBase]. -message DeleteKnowledgeBaseRequest { - // Required. The name of the knowledge base to delete. - // Format: `projects//locations//knowledgeBases/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/KnowledgeBase" - } - ]; - - // Optional. Force deletes the knowledge base. When set to true, any documents - // in the knowledge base are also deleted. - bool force = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [KnowledgeBases.UpdateKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.UpdateKnowledgeBase]. -message UpdateKnowledgeBaseRequest { - // Required. The knowledge base to update. - KnowledgeBase knowledge_base = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Not specified means `update all`. - // Currently, only `display_name` can be updated, an InvalidArgument will be - // returned for attempting to update other fields. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/participant.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/participant.proto deleted file mode 100644 index 0078aa1a..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/participant.proto +++ /dev/null @@ -1,1062 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dialogflow/v2beta1/audio_config.proto"; -import "google/cloud/dialogflow/v2beta1/gcs.proto"; -import "google/cloud/dialogflow/v2beta1/session.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "ParticipantProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; - -// Service for managing [Participants][google.cloud.dialogflow.v2beta1.Participant]. -service Participants { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Creates a new participant in a conversation. - rpc CreateParticipant(CreateParticipantRequest) returns (Participant) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*/conversations/*}/participants" - body: "participant" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/conversations/*}/participants" - body: "participant" - } - }; - option (google.api.method_signature) = "parent,participant"; - } - - // Retrieves a conversation participant. - rpc GetParticipant(GetParticipantRequest) returns (Participant) { - option (google.api.http) = { - get: "/v2beta1/{name=projects/*/conversations/*/participants/*}" - additional_bindings { - get: "/v2beta1/{name=projects/*/locations/*/conversations/*/participants/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Returns the list of all participants in the specified conversation. - rpc ListParticipants(ListParticipantsRequest) returns (ListParticipantsResponse) { - option (google.api.http) = { - get: "/v2beta1/{parent=projects/*/conversations/*}/participants" - additional_bindings { - get: "/v2beta1/{parent=projects/*/locations/*/conversations/*}/participants" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Updates the specified participant. - rpc UpdateParticipant(UpdateParticipantRequest) returns (Participant) { - option (google.api.http) = { - patch: "/v2beta1/{participant.name=projects/*/conversations/*/participants/*}" - body: "participant" - additional_bindings { - patch: "/v2beta1/{participant.name=projects/*/locations/*/conversations/*/participants/*}" - body: "participant" - } - }; - option (google.api.method_signature) = "participant,update_mask"; - } - - // Adds a text (chat, for example), or audio (phone recording, for example) - // message from a participant into the conversation. - // - // Note: Always use agent versions for production traffic - // sent to virtual agents. See [Versions and - // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). - rpc AnalyzeContent(AnalyzeContentRequest) returns (AnalyzeContentResponse) { - option (google.api.http) = { - post: "/v2beta1/{participant=projects/*/conversations/*/participants/*}:analyzeContent" - body: "*" - additional_bindings { - post: "/v2beta1/{participant=projects/*/locations/*/conversations/*/participants/*}:analyzeContent" - body: "*" - } - }; - option (google.api.method_signature) = "participant,text_input"; - option (google.api.method_signature) = "participant,event_input"; - } - - // Gets suggested articles for a participant based on specific historical - // messages. - // - // Note that [ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions] will only list the auto-generated - // suggestions, while [CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion] will try to compile suggestion - // based on the provided conversation context in the real time. - rpc SuggestArticles(SuggestArticlesRequest) returns (SuggestArticlesResponse) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestArticles" - body: "*" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestArticles" - body: "*" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets suggested faq answers for a participant based on specific historical - // messages. - rpc SuggestFaqAnswers(SuggestFaqAnswersRequest) returns (SuggestFaqAnswersResponse) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers" - body: "*" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers" - body: "*" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets smart replies for a participant based on specific historical - // messages. - rpc SuggestSmartReplies(SuggestSmartRepliesRequest) returns (SuggestSmartRepliesResponse) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestSmartReplies" - body: "*" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestSmartReplies" - body: "*" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Deprecated: Use inline suggestion, event based suggestion or - // Suggestion* API instead. - // See [HumanAgentAssistantConfig.name][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.name] for more - // details. - // Removal Date: 2020-09-01. - // - // Retrieves suggestions for live agents. - // - // This method should be used by human agent client software to fetch auto - // generated suggestions in real-time, while the conversation with an end user - // is in progress. The functionality is implemented in terms of the - // [list - // pagination](https://cloud.google.com/apis/design/design_patterns#list_pagination) - // design pattern. The client app should use the `next_page_token` field - // to fetch the next batch of suggestions. `suggestions` are sorted by - // `create_time` in descending order. - // To fetch latest suggestion, just set `page_size` to 1. - // To fetch new suggestions without duplication, send request with filter - // `create_time_epoch_microseconds > [first item's create_time of previous - // request]` and empty page_token. - rpc ListSuggestions(ListSuggestionsRequest) returns (ListSuggestionsResponse) { - option deprecated = true; - option (google.api.http) = { - get: "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions" - }; - } - - // Deprecated. use [SuggestArticles][google.cloud.dialogflow.v2beta1.Participants.SuggestArticles] and [SuggestFaqAnswers][google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers] instead. - // - // Gets suggestions for a participant based on specific historical - // messages. - // - // Note that [ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions] will only list the auto-generated - // suggestions, while [CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion] will try to compile suggestion - // based on the provided conversation context in the real time. - rpc CompileSuggestion(CompileSuggestionRequest) returns (CompileSuggestionResponse) { - option deprecated = true; - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:compile" - body: "*" - }; - } -} - -// Represents a conversation participant (human agent, virtual agent, end-user). -message Participant { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/Participant" - pattern: "projects/{project}/conversations/{conversation}/participants/{participant}" - pattern: "projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}" - }; - - // Enumeration of the roles a participant can play in a conversation. - enum Role { - // Participant role not set. - ROLE_UNSPECIFIED = 0; - - // Participant is a human agent. - HUMAN_AGENT = 1; - - // Participant is an automated agent, such as a Dialogflow agent. - AUTOMATED_AGENT = 2; - - // Participant is an end user that has called or chatted with - // Dialogflow services. - END_USER = 3; - } - - // Optional. The unique identifier of this participant. - // Format: `projects//locations//conversations//participants/`. - string name = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Immutable. The role this participant plays in the conversation. This field must be set - // during participant creation and is then immutable. - Role role = 2 [(google.api.field_behavior) = IMMUTABLE]; - - // Optional. Obfuscated user id that should be associated with the created participant. - // - // You can specify a user id as follows: - // - // 1. If you set this field in - // [CreateParticipantRequest][google.cloud.dialogflow.v2beta1.CreateParticipantRequest.participant] or - // [UpdateParticipantRequest][google.cloud.dialogflow.v2beta1.UpdateParticipantRequest.participant], - // Dialogflow adds the obfuscated user id with the participant. - // - // 2. If you set this field in - // [AnalyzeContent][google.cloud.dialogflow.v2beta1.AnalyzeContentRequest.obfuscated_external_user_id] or - // [StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.obfuscated_external_user_id], - // Dialogflow will update [Participant.obfuscated_external_user_id][google.cloud.dialogflow.v2beta1.Participant.obfuscated_external_user_id]. - // - // Dialogflow uses this user id for following purposes: - // 1) Billing and measurement. If user with the same - // obfuscated_external_user_id is created in a later conversation, dialogflow - // will know it's the same user. 2) Agent assist suggestion personalization. - // For example, Dialogflow can use it to provide personalized smart reply - // suggestions for this user. - // - // Note: - // - // * Please never pass raw user ids to Dialogflow. Always obfuscate your user - // id first. - // * Dialogflow only accepts a UTF-8 encoded string, e.g., a hex digest of a - // hash function like SHA-512. - // * The length of the user id must be <= 256 characters. - string obfuscated_external_user_id = 7 [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents a message posted into a conversation. -message Message { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/Message" - pattern: "projects/{project}/conversations/{conversation}/messages/{message}" - pattern: "projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}" - }; - - // Optional. The unique identifier of the message. - // Format: `projects//locations//conversations//messages/`. - string name = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The message content. - string content = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The message language. - // This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) - // language tag. Example: "en-US". - string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The participant that sends this message. - string participant = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The role of the participant. - Participant.Role participant_role = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the message was created in Contact Center AI. - google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The time when the message was sent. - google.protobuf.Timestamp send_time = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The annotation for the message. - MessageAnnotation message_annotation = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The sentiment analysis result for the message. - SentimentAnalysisResult sentiment_analysis = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The request message for [Participants.CreateParticipant][google.cloud.dialogflow.v2beta1.Participants.CreateParticipant]. -message CreateParticipantRequest { - // Required. Resource identifier of the conversation adding the participant. - // Format: `projects//locations//conversations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Participant" - } - ]; - - // Required. The participant to create. - Participant participant = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [Participants.GetParticipant][google.cloud.dialogflow.v2beta1.Participants.GetParticipant]. -message GetParticipantRequest { - // Required. The name of the participant. Format: - // `projects//locations//conversations//participants/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Participant" - } - ]; -} - -// The request message for [Participants.ListParticipants][google.cloud.dialogflow.v2beta1.Participants.ListParticipants]. -message ListParticipantsRequest { - // Required. The conversation to list all participants from. - // Format: `projects//locations//conversations/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Participant" - } - ]; - - // Optional. The maximum number of items to return in a single page. By - // default 100 and at most 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response message for [Participants.ListParticipants][google.cloud.dialogflow.v2beta1.Participants.ListParticipants]. -message ListParticipantsResponse { - // The list of participants. There is a maximum number of items - // returned based on the page_size field in the request. - repeated Participant participants = 1; - - // Token to retrieve the next page of results or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request message for [Participants.UpdateParticipant][google.cloud.dialogflow.v2beta1.Participants.UpdateParticipant]. -message UpdateParticipantRequest { - // Required. The participant to update. - Participant participant = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The mask to specify which fields to update. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Represents the natural language speech audio to be played to the end user. -message OutputAudio { - // Required. Instructs the speech synthesizer how to generate the speech - // audio. - OutputAudioConfig config = 1; - - // Required. The natural language speech audio. - bytes audio = 2; -} - -// Represents a response from an automated agent. -message AutomatedAgentReply { - // Represents different automated agent reply types. - enum AutomatedAgentReplyType { - // Not specified. This should never happen. - AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED = 0; - - // Partial reply. e.g. Aggregated responses in a `Fulfillment` that enables - // `return_partial_response` can be returned as partial reply. - // WARNING: partial reply is not eligible for barge-in. - PARTIAL = 1; - - // Final reply. - FINAL = 2; - } - - // Required. - oneof response { - // Response of the Dialogflow [Sessions.DetectIntent][google.cloud.dialogflow.v2beta1.Sessions.DetectIntent] call. - DetectIntentResponse detect_intent_response = 1; - } - - // Response messages from the automated agent. - repeated ResponseMessage response_messages = 3; - - // Info on the query match for the automated agent response. - oneof match { - // Name of the intent if an intent is matched for the query. - // For a V2 query, the value format is `projects//locations/ - // /agent/intents/`. - // For a V3 query, the value format is `projects//locations/ - // /agents//intents/`. - string intent = 4 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Intent" - }]; - - // Event name if an event is triggered for the query. - string event = 5; - } - - // The confidence of the match. Values range from 0.0 (completely uncertain) - // to 1.0 (completely certain). - // This value is for informational purpose only and is only used to help match - // the best intent within the classification threshold. This value may change - // for the same end-user expression at any time due to a model retraining or - // change in implementation. - float match_confidence = 9; - - // The collection of current parameters at the time of this response. - google.protobuf.Struct parameters = 10; - - // The collection of current Dialogflow CX agent session parameters at the - // time of this response. - // Deprecated: Use `parameters` instead. - google.protobuf.Struct cx_session_parameters = 6 [deprecated = true]; - - // AutomatedAgentReply type. - AutomatedAgentReplyType automated_agent_reply_type = 7; - - // Indicates whether the partial automated agent reply is interruptible when a - // later reply message arrives. e.g. if the agent specified some music as - // partial response, it can be cancelled. - bool allow_cancellation = 8; -} - -// The type of Human Agent Assistant API suggestion to perform, and the maximum -// number of results to return for that type. Multiple `Feature` objects can -// be specified in the `features` list. -message SuggestionFeature { - // Defines the type of Human Agent Assistant feature. - enum Type { - // Unspecified feature type. - TYPE_UNSPECIFIED = 0; - - // Run article suggestion model. - ARTICLE_SUGGESTION = 1; - - // Run FAQ model. - FAQ = 2; - - // Run smart reply model. - SMART_REPLY = 3; - } - - // Type of Human Agent Assistant API feature to request. - Type type = 1; -} - -// The request message for [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent]. -message AnalyzeContentRequest { - // Required. The name of the participant this text comes from. - // Format: `projects//locations//conversations//participants/`. - string participant = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Participant" - } - ]; - - // Required. The input content. - oneof input { - // The natural language text to be processed. - TextInput text_input = 6; - - // An input event to send to Dialogflow. - EventInput event_input = 8; - } - - // Speech synthesis configuration. - // The speech synthesis settings for a virtual agent that may be configured - // for the associated conversation profile are not used when calling - // AnalyzeContent. If this configuration is not supplied, speech synthesis - // is disabled. - OutputAudioConfig reply_audio_config = 5; - - // Parameters for a Dialogflow virtual-agent query. - QueryParameters query_params = 9; - - // Optional. The send time of the message from end user or human agent's - // perspective. It is used for identifying the same message under one - // participant. - // - // Given two messages under the same participant: - // - If send time are different regardless of whether the content of the - // messages are exactly the same, the conversation will regard them as - // two distinct messages sent by the participant. - // - If send time is the same regardless of whether the content of the - // messages are exactly the same, the conversation will regard them as - // same message, and ignore the message received later. - // - // If the value is not provided, a new request will always be regarded as a - // new message without any de-duplication. - google.protobuf.Timestamp message_send_time = 10; - - // A unique identifier for this request. Restricted to 36 ASCII characters. - // A random UUID is recommended. - // This request is only idempotent if a `request_id` is provided. - string request_id = 11; -} - -// The message in the response that indicates the parameters of DTMF. -message DtmfParameters { - // Indicates whether DTMF input can be handled in the next request. - bool accepts_dtmf_input = 1; -} - -// The response message for [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent]. -message AnalyzeContentResponse { - // Output only. The output text content. - // This field is set if the automated agent responded with text to show to - // the user. - string reply_text = 1; - - // Optional. The audio data bytes encoded as specified in the request. - // This field is set if: - // - // - `reply_audio_config` was specified in the request, or - // - The automated agent responded with audio to play to the user. In such - // case, `reply_audio.config` contains settings used to synthesize the - // speech. - // - // In some scenarios, multiple output audio fields may be present in the - // response structure. In these cases, only the top-most-level audio output - // has content. - OutputAudio reply_audio = 2; - - // Optional. Only set if a Dialogflow automated agent has responded. - // Note that: [AutomatedAgentReply.detect_intent_response.output_audio][] - // and [AutomatedAgentReply.detect_intent_response.output_audio_config][] - // are always empty, use [reply_audio][google.cloud.dialogflow.v2beta1.AnalyzeContentResponse.reply_audio] instead. - AutomatedAgentReply automated_agent_reply = 3; - - // Output only. Message analyzed by CCAI. - Message message = 5; - - // The suggestions for most recent human agent. The order is the same as - // [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.feature_configs] of - // [HumanAgentAssistantConfig.human_agent_suggestion_config][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.human_agent_suggestion_config]. - repeated SuggestionResult human_agent_suggestion_results = 6; - - // The suggestions for end user. The order is the same as - // [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.feature_configs] of - // [HumanAgentAssistantConfig.end_user_suggestion_config][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.end_user_suggestion_config]. - repeated SuggestionResult end_user_suggestion_results = 7; - - // Indicates the parameters of DTMF. - DtmfParameters dtmf_parameters = 9; -} - -// Represents a part of a message possibly annotated with an entity. The part -// can be an entity or purely a part of the message between two entities or -// message start/end. -message AnnotatedMessagePart { - // Required. A part of a message possibly annotated with an entity. - string text = 1; - - // Optional. The [Dialogflow system entity - // type](https://cloud.google.com/dialogflow/docs/reference/system-entities) - // of this message part. If this is empty, Dialogflow could not annotate the - // phrase part with a system entity. - string entity_type = 2; - - // Optional. The [Dialogflow system entity formatted value - // ](https://cloud.google.com/dialogflow/docs/reference/system-entities) of - // this message part. For example for a system entity of type - // `@sys.unit-currency`, this may contain: - //
-  // {
-  //   "amount": 5,
-  //   "currency": "USD"
-  // }
-  // 
- google.protobuf.Value formatted_value = 3; -} - -// Represents the result of annotation for the message. -message MessageAnnotation { - // Optional. The collection of annotated message parts ordered by their - // position in the message. You can recover the annotated message by - // concatenating [AnnotatedMessagePart.text]. - repeated AnnotatedMessagePart parts = 1; - - // Required. Indicates whether the text message contains entities. - bool contain_entities = 2; -} - -// Represents article answer. -message ArticleAnswer { - // The article title. - string title = 1; - - // The article URI. - string uri = 2; - - // Output only. Article snippets. - repeated string snippets = 3; - - // A map that contains metadata about the answer and the - // document from which it originates. - map metadata = 5; - - // The name of answer record, in the format of - // "projects//locations//answerRecords/" - string answer_record = 6; -} - -// Represents answer from "frequently asked questions". -message FaqAnswer { - // The piece of text from the `source` knowledge base document. - string answer = 1; - - // The system's confidence score that this Knowledge answer is a good match - // for this conversational query, range from 0.0 (completely uncertain) - // to 1.0 (completely certain). - float confidence = 2; - - // The corresponding FAQ question. - string question = 3; - - // Indicates which Knowledge Document this answer was extracted - // from. - // Format: `projects//locations//agent/knowledgeBases//documents/`. - string source = 4; - - // A map that contains metadata about the answer and the - // document from which it originates. - map metadata = 5; - - // The name of answer record, in the format of - // "projects//locations//answerRecords/" - string answer_record = 6; -} - -// Represents a smart reply answer. -message SmartReplyAnswer { - // The content of the reply. - string reply = 1; - - // Smart reply confidence. - // The system's confidence score that this reply is a good match for - // this conversation, as a value from 0.0 (completely uncertain) to 1.0 - // (completely certain). - float confidence = 2; - - // The name of answer record, in the format of - // "projects//locations//answerRecords/" - string answer_record = 3; -} - -// One response of different type of suggestion response which is used in -// the response of [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] and -// [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent], as well as [HumanAgentAssistantEvent][google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent]. -message SuggestionResult { - // Different type of suggestion response. - oneof suggestion_response { - // Error status if the request failed. - google.rpc.Status error = 1; - - // SuggestArticlesResponse if request is for ARTICLE_SUGGESTION. - SuggestArticlesResponse suggest_articles_response = 2; - - // SuggestFaqAnswersResponse if request is for FAQ_ANSWER. - SuggestFaqAnswersResponse suggest_faq_answers_response = 3; - - // SuggestSmartRepliesResponse if request is for SMART_REPLY. - SuggestSmartRepliesResponse suggest_smart_replies_response = 4; - } -} - -// The request message for [Participants.SuggestArticles][google.cloud.dialogflow.v2beta1.Participants.SuggestArticles]. -message SuggestArticlesRequest { - // Required. The name of the participant to fetch suggestion for. - // Format: `projects//locations//conversations//participants/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Participant" - } - ]; - - // Optional. The name of the latest conversation message to compile suggestion - // for. If empty, it will be the latest message of the conversation. - // - // Format: `projects//locations//conversations//messages/`. - string latest_message = 2 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Message" - } - ]; - - // Optional. Max number of messages prior to and including - // [latest_message][google.cloud.dialogflow.v2beta1.SuggestArticlesRequest.latest_message] to use as context - // when compiling the suggestion. By default 20 and at most 50. - int32 context_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response message for [Participants.SuggestArticles][google.cloud.dialogflow.v2beta1.Participants.SuggestArticles]. -message SuggestArticlesResponse { - // Output only. Articles ordered by score in descending order. - repeated ArticleAnswer article_answers = 1; - - // The name of the latest conversation message used to compile - // suggestion for. - // - // Format: `projects//locations//conversations//messages/`. - string latest_message = 2; - - // Number of messages prior to and including - // [latest_message][google.cloud.dialogflow.v2beta1.SuggestArticlesResponse.latest_message] to compile the - // suggestion. It may be smaller than the - // [SuggestArticlesResponse.context_size][google.cloud.dialogflow.v2beta1.SuggestArticlesResponse.context_size] field in the request if there - // aren't that many messages in the conversation. - int32 context_size = 3; -} - -// The request message for [Participants.SuggestFaqAnswers][google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers]. -message SuggestFaqAnswersRequest { - // Required. The name of the participant to fetch suggestion for. - // Format: `projects//locations//conversations//participants/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Participant" - } - ]; - - // Optional. The name of the latest conversation message to compile suggestion - // for. If empty, it will be the latest message of the conversation. - // - // Format: `projects//locations//conversations//messages/`. - string latest_message = 2 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Message" - } - ]; - - // Optional. Max number of messages prior to and including - // [latest_message] to use as context when compiling the - // suggestion. By default 20 and at most 50. - int32 context_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for [Participants.SuggestFaqAnswers][google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers]. -message SuggestFaqAnswersResponse { - // Output only. Answers extracted from FAQ documents. - repeated FaqAnswer faq_answers = 1; - - // The name of the latest conversation message used to compile - // suggestion for. - // - // Format: `projects//locations//conversations//messages/`. - string latest_message = 2; - - // Number of messages prior to and including - // [latest_message][google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse.latest_message] to compile the - // suggestion. It may be smaller than the - // [SuggestFaqAnswersRequest.context_size][google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest.context_size] field in the request if there - // aren't that many messages in the conversation. - int32 context_size = 3; -} - -// The request message for [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2beta1.Participants.SuggestSmartReplies]. -message SuggestSmartRepliesRequest { - // Required. The name of the participant to fetch suggestion for. - // Format: `projects//locations//conversations//participants/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Participant" - } - ]; - - // The current natural language text segment to compile suggestion - // for. This provides a way for user to get follow up smart reply suggestion - // after a smart reply selection, without sending a text message. - TextInput current_text_input = 4; - - // The name of the latest conversation message to compile suggestion - // for. If empty, it will be the latest message of the conversation. - // - // Format: `projects//locations//conversations//messages/`. - string latest_message = 2 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Message" - }]; - - // Optional. Max number of messages prior to and including - // [latest_message] to use as context when compiling the - // suggestion. By default 20 and at most 50. - int32 context_size = 3; -} - -// The response message for [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2beta1.Participants.SuggestSmartReplies]. -message SuggestSmartRepliesResponse { - // Output only. Multiple reply options provided by smart reply service. The - // order is based on the rank of the model prediction. - // The maximum number of the returned replies is set in SmartReplyConfig. - repeated SmartReplyAnswer smart_reply_answers = 1; - - // The name of the latest conversation message used to compile - // suggestion for. - // - // Format: `projects//locations//conversations//messages/`. - string latest_message = 2; - - // Number of messages prior to and including - // [latest_message][google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse.latest_message] to compile the - // suggestion. It may be smaller than the - // [SuggestSmartRepliesRequest.context_size][google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest.context_size] field in the request if there - // aren't that many messages in the conversation. - int32 context_size = 3; -} - -// Represents a suggestion for a human agent. -message Suggestion { - option deprecated = true; - - // Represents suggested article. - message Article { - // Output only. The article title. - string title = 1; - - // Output only. The article URI. - string uri = 2; - - // Output only. Article snippets. - repeated string snippets = 3; - - // Output only. A map that contains metadata about the answer and the - // document from which it originates. - map metadata = 5; - - // Output only. The name of answer record, in the format of - // "projects//locations//answerRecords/" - string answer_record = 6; - } - - // Represents suggested answer from "frequently asked questions". - message FaqAnswer { - // Output only. The piece of text from the `source` knowledge base document. - string answer = 1; - - // The system's confidence score that this Knowledge answer is a good match - // for this conversational query, range from 0.0 (completely uncertain) - // to 1.0 (completely certain). - float confidence = 2; - - // Output only. The corresponding FAQ question. - string question = 3; - - // Output only. Indicates which Knowledge Document this answer was extracted - // from. - // Format: `projects//locations//agent/knowledgeBases//documents/`. - string source = 4; - - // Output only. A map that contains metadata about the answer and the - // document from which it originates. - map metadata = 5; - - // Output only. The name of answer record, in the format of - // "projects//locations//answerRecords/" - string answer_record = 6; - } - - // Output only. The name of this suggestion. - // Format: - // `projects//locations//conversations//participants/*/suggestions/`. - string name = 1; - - // Output only. Articles ordered by score in descending order. - repeated Article articles = 2; - - // Output only. Answers extracted from FAQ documents. - repeated FaqAnswer faq_answers = 4; - - // Output only. The time the suggestion was created. - google.protobuf.Timestamp create_time = 5; - - // Output only. Latest message used as context to compile this suggestion. - // - // Format: `projects//locations//conversations//messages/`. - string latest_message = 7; -} - -// The request message for [Participants.ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions]. -message ListSuggestionsRequest { - option deprecated = true; - - // Required. The name of the participant to fetch suggestions for. - // Format: `projects//locations//conversations//participants/`. - string parent = 1; - - // Optional. The maximum number of items to return in a single page. The - // default value is 100; the maximum value is 1000. - int32 page_size = 2; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 3; - - // Optional. Filter on suggestions fields. Currently predicates on - // `create_time` and `create_time_epoch_microseconds` are supported. - // `create_time` only support milliseconds accuracy. E.g., - // `create_time_epoch_microseconds > 1551790877964485` or - // `create_time > "2017-01-15T01:30:15.01Z"` - // - // For more information about filtering, see - // [API Filtering](https://aip.dev/160). - string filter = 4; -} - -// The response message for [Participants.ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions]. -message ListSuggestionsResponse { - option deprecated = true; - - // Required. The list of suggestions. There will be a maximum number of items - // returned based on the page_size field in the request. `suggestions` is - // sorted by `create_time` in descending order. - repeated Suggestion suggestions = 1; - - // Optional. Token to retrieve the next page of results or empty if there are - // no more results in the list. - string next_page_token = 2; -} - -// The request message for [Participants.CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion]. -message CompileSuggestionRequest { - option deprecated = true; - - // Required. The name of the participant to fetch suggestion for. - // Format: `projects//locations//conversations//participants/`. - string parent = 1; - - // Optional. The name of the latest conversation message to compile suggestion - // for. If empty, it will be the latest message of the conversation. - // - // Format: `projects//locations//conversations//messages/`. - string latest_message = 2; - - // Optional. Max number of messages prior to and including - // [latest_message] to use as context when compiling the - // suggestion. If zero or less than zero, 20 is used. - int32 context_size = 3; -} - -// The response message for [Participants.CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion]. -message CompileSuggestionResponse { - option deprecated = true; - - // The compiled suggestion. - Suggestion suggestion = 1; - - // The name of the latest conversation message used to compile - // suggestion for. - // - // Format: `projects//locations//conversations//messages/`. - string latest_message = 2; - - // Number of messages prior to and including - // [latest_message][google.cloud.dialogflow.v2beta1.CompileSuggestionResponse.latest_message] - // to compile the suggestion. It may be smaller than the - // [CompileSuggestionRequest.context_size][google.cloud.dialogflow.v2beta1.CompileSuggestionRequest.context_size] field in the request if - // there aren't that many messages in the conversation. - int32 context_size = 3; -} - -// Response messages from an automated agent. -message ResponseMessage { - // The text response message. - message Text { - // A collection of text responses. - repeated string text = 1; - } - - // Indicates that the conversation should be handed off to a human agent. - // - // Dialogflow only uses this to determine which conversations were handed off - // to a human agent for measurement purposes. What else to do with this signal - // is up to you and your handoff procedures. - // - // You may set this, for example: - // * In the entry fulfillment of a CX Page if entering the page indicates - // something went extremely wrong in the conversation. - // * In a webhook response when you determine that the customer issue can only - // be handled by a human. - message LiveAgentHandoff { - // Custom metadata for your handoff procedure. Dialogflow doesn't impose - // any structure on this. - google.protobuf.Struct metadata = 1; - } - - // Indicates that interaction with the Dialogflow agent has ended. - message EndInteraction { - - } - - // Required. The rich response message. - oneof message { - // Returns a text response. - Text text = 1; - - // Returns a response containing a custom, platform-specific payload. - google.protobuf.Struct payload = 2; - - // Hands off conversation to a live agent. - LiveAgentHandoff live_agent_handoff = 3; - - // A signal that indicates the interaction with the Dialogflow agent has - // ended. - EndInteraction end_interaction = 4; - } -} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/session.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/session.proto deleted file mode 100644 index 6a5a67cd..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/session.proto +++ /dev/null @@ -1,812 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dialogflow/v2beta1/agent.proto"; -import "google/cloud/dialogflow/v2beta1/audio_config.proto"; -import "google/cloud/dialogflow/v2beta1/context.proto"; -import "google/cloud/dialogflow/v2beta1/gcs.proto"; -import "google/cloud/dialogflow/v2beta1/intent.proto"; -import "google/cloud/dialogflow/v2beta1/session_entity_type.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; -import "google/rpc/status.proto"; -import "google/type/latlng.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "SessionProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; -option (google.api.resource_definition) = { - type: "dialogflow.googleapis.com/Session" - pattern: "projects/{project}/agent/sessions/{session}" - pattern: "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}" - pattern: "projects/{project}/locations/{location}/agent/sessions/{session}" - pattern: "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}" -}; - -// A service used for session interactions. -// -// For more information, see the [API interactions -// guide](https://cloud.google.com/dialogflow/docs/api-overview). -service Sessions { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Processes a natural language query and returns structured, actionable data - // as a result. This method is not idempotent, because it may cause contexts - // and session entity types to be updated, which in turn might affect - // results of future queries. - // - // 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" - body: "*" - additional_bindings { - post: "/v2beta1/{session=projects/*/agent/environments/*/users/*/sessions/*}:detectIntent" - body: "*" - } - additional_bindings { - post: "/v2beta1/{session=projects/*/locations/*/agent/sessions/*}:detectIntent" - body: "*" - } - additional_bindings { - post: "/v2beta1/{session=projects/*/locations/*/agent/environments/*/users/*/sessions/*}:detectIntent" - body: "*" - } - }; - option (google.api.method_signature) = "session,query_input"; - } - - // 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) { - } -} - -// The request to detect user's intent. -message DetectIntentRequest { - // Required. The name of the session this query is sent to. Supported formats: - // - `projects//agent/sessions/, - // - `projects//locations//agent/sessions/`, - // - `projects//agent/environments//users//sessions/`, - // - `projects//locations//agent/environments//users//sessions/`, - // - // If `Location ID` is not specified we assume default 'us' location. If - // `Environment ID` is not specified, we assume default 'draft' environment - // (`Environment ID` might be referred to as environment name at some places). - // If `User ID` is not specified, we are using "-". It's up to the API caller - // to choose an appropriate `Session ID` and `User Id`. They can be a random - // number or some type of user and session identifiers (preferably hashed). - // 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) = { - type: "dialogflow.googleapis.com/Session" - } - ]; - - // The parameters of this query. - QueryParameters query_params = 2; - - // Required. The input specification. It can be set to: - // - // 1. an audio config - // which instructs the speech recognizer how to process the speech audio, - // - // 2. a conversational query in the form of text, or - // - // 3. an event that specifies which intent to trigger. - QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; - - // Instructs the speech synthesizer how to generate the output - // audio. If this field is not set and agent-level speech synthesizer is not - // configured, no output audio is generated. - OutputAudioConfig output_audio_config = 4; - - // Mask for [output_audio_config][google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config] indicating which settings in this - // request-level config should override speech synthesizer settings defined at - // agent-level. - // - // If unspecified or empty, [output_audio_config][google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config] replaces the agent-level - // config in its entirety. - google.protobuf.FieldMask output_audio_config_mask = 7; - - // The natural language speech audio to be processed. This field - // should be populated iff `query_input` is set to an input audio config. - // A single request can contain up to 1 minute of speech audio data. - bytes input_audio = 5; -} - -// The message returned from the DetectIntent method. -message DetectIntentResponse { - // The unique identifier of the response. It can be used to - // locate a response in the training example set or for reporting issues. - string response_id = 1; - - // The selected results of the conversational query or event processing. - // See `alternative_query_results` for additional potential results. - QueryResult query_result = 2; - - // If Knowledge Connectors are enabled, there could be more than one result - // returned for a given query or event, and this field will contain all - // results except for the top one, which is captured in query_result. The - // alternative results are ordered by decreasing - // `QueryResult.intent_detection_confidence`. If Knowledge Connectors are - // disabled, this field will be empty until multiple responses for regular - // intents are supported, at which point those additional results will be - // surfaced here. - repeated QueryResult alternative_query_results = 5; - - // Specifies the status of the webhook request. - google.rpc.Status webhook_status = 3; - - // The audio data bytes encoded as specified in the request. - // Note: The output audio is generated based on the values of default platform - // text responses found in the `query_result.fulfillment_messages` field. If - // multiple default text responses exist, they will be concatenated when - // generating audio. If no default platform text responses exist, the - // generated audio content will be empty. - // - // In some scenarios, multiple output audio fields may be present in the - // response structure. In these cases, only the top-most-level audio output - // has content. - bytes output_audio = 4; - - // The config used by the speech synthesizer to generate the output audio. - OutputAudioConfig output_audio_config = 6; -} - -// Represents the parameters of the conversational query. -message QueryParameters { - // The time zone of this conversational query from the - // [time zone database](https://www.iana.org/time-zones), e.g., - // America/New_York, Europe/Paris. If not provided, the time zone specified in - // agent settings is used. - string time_zone = 1; - - // The geo location of this conversational query. - google.type.LatLng geo_location = 2; - - // The collection of contexts to be activated before this query is - // executed. - repeated Context contexts = 3; - - // Specifies whether to delete all contexts in the current session - // before the new ones are activated. - bool reset_contexts = 4; - - // Additional session entity types to replace or extend developer - // entity types with. The entity synonyms apply to all languages and persist - // for the session of this query. - repeated SessionEntityType session_entity_types = 5; - - // This field can be used to pass custom data to your webhook. - // Arbitrary JSON objects are supported. - // If supplied, the value is used to populate the - // `WebhookRequest.original_detect_intent_request.payload` - // field sent to your webhook. - google.protobuf.Struct payload = 6; - - // KnowledgeBases to get alternative results from. If not set, the - // KnowledgeBases enabled in the agent (through UI) will be used. - // Format: `projects//knowledgeBases/`. - repeated string knowledge_base_names = 12; - - // Configures the type of sentiment analysis to perform. If not - // provided, sentiment analysis is not performed. - // Note: Sentiment Analysis is only currently available for Essentials Edition - // agents. - SentimentAnalysisRequestConfig sentiment_analysis_request_config = 10; - - // For mega agent query, directly specify which sub agents to query. - // If any specified sub agent is not linked to the mega agent, an error will - // be returned. If empty, Dialogflow will decide which sub agents to query. - // If specified for a non-mega-agent query, will be silently ignored. - 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 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. - // Google's specified headers are not allowed. Including: "Host", - // "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding", - // "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc. - map webhook_headers = 14; -} - -// Represents the query input. It can contain either: -// -// 1. An audio config which -// instructs the speech recognizer how to process the speech audio. -// -// 2. A conversational query in the form of text. -// -// 3. An event that specifies which intent to trigger. -message QueryInput { - // Required. The input specification. - oneof input { - // Instructs the speech recognizer how to process the speech audio. - InputAudioConfig audio_config = 1; - - // The natural language text to be processed. - TextInput text = 2; - - // The event to be processed. - EventInput event = 3; - - // The DTMF digits used to invoke intent and fill in parameter value. - TelephonyDtmfEvents dtmf = 4; - } -} - -// Represents the result of conversational query or event processing. -message QueryResult { - // The original conversational query text: - // - // - If natural language text was provided as input, `query_text` contains - // a copy of the input. - // - If natural language speech audio was provided as input, `query_text` - // contains the speech recognition result. If speech recognizer produced - // multiple alternatives, a particular one is picked. - // - If automatic spell correction is enabled, `query_text` will contain the - // corrected user input. - string query_text = 1; - - // The language that was triggered during intent detection. - // See [Language - // Support](https://cloud.google.com/dialogflow/docs/reference/language) - // for a list of the currently supported language codes. - string language_code = 15; - - // The Speech recognition confidence between 0.0 and 1.0. A higher number - // indicates an estimated greater likelihood that the recognized words are - // correct. The default of 0.0 is a sentinel value indicating that confidence - // was not set. - // - // This field is not guaranteed to be accurate or set. In particular this - // field isn't set for StreamingDetectIntent since the streaming endpoint has - // separate confidence estimates per portion of the audio in - // StreamingRecognitionResult. - float speech_recognition_confidence = 2; - - // The action name from the matched intent. - string action = 3; - - // The collection of extracted parameters. - // - // Depending on your protocol or client library language, this is a - // map, associative array, symbol table, dictionary, or JSON object - // composed of a collection of (MapKey, MapValue) pairs: - // - // - MapKey type: string - // - MapKey value: parameter name - // - MapValue type: - // - If parameter's entity type is a composite entity: map - // - Else: depending on parameter value type, could be one of string, - // number, boolean, null, list or map - // - MapValue value: - // - If parameter's entity type is a composite entity: - // map from composite entity property names to property values - // - Else: parameter value - google.protobuf.Struct parameters = 4; - - // This field is set to: - // - // - `false` if the matched intent has required parameters and not all of - // the required parameter values have been collected. - // - `true` if all required parameter values have been collected, or if the - // matched intent doesn't contain any required parameters. - bool all_required_params_present = 5; - - // Indicates whether the conversational query triggers a cancellation for slot - // filling. - bool cancels_slot_filling = 21; - - // The text to be pronounced to the user or shown on the screen. - // Note: This is a legacy field, `fulfillment_messages` should be preferred. - string fulfillment_text = 6; - - // The collection of rich messages to present to the user. - repeated Intent.Message fulfillment_messages = 7; - - // If the query was fulfilled by a webhook call, this field is set to the - // value of the `source` field returned in the webhook response. - string webhook_source = 8; - - // If the query was fulfilled by a webhook call, this field is set to the - // value of the `payload` field returned in the webhook response. - google.protobuf.Struct webhook_payload = 9; - - // The collection of output contexts. If applicable, - // `output_contexts.parameters` contains entries with name - // `.original` containing the original parameter values - // before the query. - repeated Context output_contexts = 10; - - // The intent that matched the conversational query. Some, not - // all fields are filled in this message, including but not limited to: - // `name`, `display_name`, `end_interaction` and `is_fallback`. - Intent intent = 11; - - // The intent detection confidence. Values range from 0.0 - // (completely uncertain) to 1.0 (completely certain). - // This value is for informational purpose only and is only used to - // help match the best intent within the classification threshold. - // This value may change for the same end-user expression at any time due to a - // model retraining or change in implementation. - // If there are `multiple knowledge_answers` messages, this value is set to - // the greatest `knowledgeAnswers.match_confidence` value in the list. - float intent_detection_confidence = 12; - - // Free-form diagnostic information for the associated detect intent request. - // The fields of this data can change without notice, so you should not write - // code that depends on its structure. - // The data may contain: - // - // - webhook call latency - // - webhook errors - google.protobuf.Struct diagnostic_info = 14; - - // The sentiment analysis result, which depends on the - // `sentiment_analysis_request_config` specified in the request. - SentimentAnalysisResult sentiment_analysis_result = 17; - - // The result from Knowledge Connector (if any), ordered by decreasing - // `KnowledgeAnswers.match_confidence`. - KnowledgeAnswers knowledge_answers = 18; -} - -// Represents the result of querying a Knowledge base. -message KnowledgeAnswers { - // An answer from Knowledge Connector. - message Answer { - // Represents the system's confidence that this knowledge answer is a good - // match for this conversational query. - enum MatchConfidenceLevel { - // Not specified. - MATCH_CONFIDENCE_LEVEL_UNSPECIFIED = 0; - - // Indicates that the confidence is low. - LOW = 1; - - // Indicates our confidence is medium. - MEDIUM = 2; - - // Indicates our confidence is high. - HIGH = 3; - } - - // Indicates which Knowledge Document this answer was extracted from. - // Format: `projects//knowledgeBases//documents/`. - string source = 1 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Document" - }]; - - // The corresponding FAQ question if the answer was extracted from a FAQ - // Document, empty otherwise. - string faq_question = 2; - - // The piece of text from the `source` knowledge base document that answers - // this conversational query. - string answer = 3; - - // The system's confidence level that this knowledge answer is a good match - // for this conversational query. - // NOTE: The confidence level for a given `` pair may change - // without notice, as it depends on models that are constantly being - // improved. However, it will change less frequently than the confidence - // score below, and should be preferred for referencing the quality of an - // answer. - MatchConfidenceLevel match_confidence_level = 4; - - // The system's confidence score that this Knowledge answer is a good match - // for this conversational query. - // The range is from 0.0 (completely uncertain) to 1.0 (completely certain). - // Note: The confidence score is likely to vary somewhat (possibly even for - // identical requests), as the underlying model is under constant - // improvement. It may be deprecated in the future. We recommend using - // `match_confidence_level` which should be generally more stable. - float match_confidence = 5; - } - - // A list of answers from Knowledge Connector. - repeated Answer answers = 1; -} - -// The top-level message sent by the client to the -// [Sessions.StreamingDetectIntent][google.cloud.dialogflow.v2beta1.Sessions.StreamingDetectIntent] method. -// -// Multiple request messages should be sent in order: -// -// 1. The first message must contain -// [session][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.session], -// [query_input][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_input] plus optionally -// [query_params][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_params]. If the client -// wants to receive an audio response, it should also contain -// [output_audio_config][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config]. -// The message must not contain -// [input_audio][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.input_audio]. -// 2. If [query_input][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_input] was set to -// [query_input.audio_config][google.cloud.dialogflow.v2beta1.InputAudioConfig], all subsequent -// messages must contain -// [input_audio][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.input_audio] to continue with -// Speech recognition. -// If you decide to rather detect an intent from text input after you -// already started Speech recognition, please send a message with -// [query_input.text][google.cloud.dialogflow.v2beta1.QueryInput.text]. -// -// However, note that: -// -// * Dialogflow will bill you for the audio duration so far. -// * Dialogflow discards all Speech recognition results in favor of the -// input text. -// * Dialogflow will use the language code from the first message. -// -// After you sent all input, you must half-close or abort the request stream. -message StreamingDetectIntentRequest { - // Required. The name of the session the query is sent to. - // Supported formats: - // - `projects//agent/sessions/, - // - `projects//locations//agent/sessions/`, - // - `projects//agent/environments//users//sessions/`, - // - `projects//locations//agent/environments//users//sessions/`, - // - // If `Location ID` is not specified we assume default 'us' location. If - // `Environment ID` is not specified, we assume default 'draft' environment. - // If `User ID` is not specified, we are using "-". It's up to the API caller - // to choose an appropriate `Session ID` and `User Id`. They can be a random - // number or some type of user and session identifiers (preferably hashed). - // 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) = { - type: "dialogflow.googleapis.com/Session" - } - ]; - - // The parameters of this query. - QueryParameters query_params = 2; - - // Required. The input specification. It can be set to: - // - // 1. an audio config which instructs the speech recognizer how to process - // the speech audio, - // - // 2. a conversational query in the form of text, or - // - // 3. an event that specifies which intent to trigger. - QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; - - // DEPRECATED. Please use [InputAudioConfig.single_utterance][google.cloud.dialogflow.v2beta1.InputAudioConfig.single_utterance] instead. - // If `false` (default), recognition does not cease until the - // client closes the stream. - // If `true`, the recognizer will detect a single spoken utterance in input - // audio. Recognition ceases when it detects the audio's voice has - // stopped or paused. In this case, once a detected intent is received, the - // client should close the stream and start a new request with a new stream as - // needed. - // This setting is ignored when `query_input` is a piece of text or an event. - bool single_utterance = 4 [deprecated = true]; - - // Instructs the speech synthesizer how to generate the output - // audio. If this field is not set and agent-level speech synthesizer is not - // configured, no output audio is generated. - OutputAudioConfig output_audio_config = 5; - - // Mask for [output_audio_config][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config] indicating which settings in this - // request-level config should override speech synthesizer settings defined at - // agent-level. - // - // If unspecified or empty, [output_audio_config][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config] replaces the agent-level - // config in its entirety. - google.protobuf.FieldMask output_audio_config_mask = 7; - - // The input audio content to be recognized. Must be sent if - // `query_input` was set to a streaming input audio config. The complete audio - // over all streaming messages must not exceed 1 minute. - bytes input_audio = 6; -} - -// The top-level message returned from the -// `StreamingDetectIntent` method. -// -// Multiple response messages can be returned in order: -// -// 1. If the input was set to streaming audio, the first one or more messages -// contain `recognition_result`. Each `recognition_result` represents a more -// complete transcript of what the user said. The last `recognition_result` -// has `is_final` set to `true`. -// -// 2. The next message contains `response_id`, `query_result`, -// `alternative_query_results` and optionally `webhook_status` if a WebHook -// was called. -// -// 3. If `output_audio_config` was specified in the request or agent-level -// speech synthesizer is configured, all subsequent messages contain -// `output_audio` and `output_audio_config`. -message StreamingDetectIntentResponse { - // The unique identifier of the response. It can be used to - // locate a response in the training example set or for reporting issues. - string response_id = 1; - - // The result of speech recognition. - StreamingRecognitionResult recognition_result = 2; - - // The selected results of the conversational query or event processing. - // See `alternative_query_results` for additional potential results. - QueryResult query_result = 3; - - // If Knowledge Connectors are enabled, there could be more than one result - // returned for a given query or event, and this field will contain all - // results except for the top one, which is captured in query_result. The - // alternative results are ordered by decreasing - // `QueryResult.intent_detection_confidence`. If Knowledge Connectors are - // disabled, this field will be empty until multiple responses for regular - // intents are supported, at which point those additional results will be - // surfaced here. - repeated QueryResult alternative_query_results = 7; - - // Specifies the status of the webhook request. - google.rpc.Status webhook_status = 4; - - // The audio data bytes encoded as specified in the request. - // Note: The output audio is generated based on the values of default platform - // text responses found in the `query_result.fulfillment_messages` field. If - // multiple default text responses exist, they will be concatenated when - // generating audio. If no default platform text responses exist, the - // generated audio content will be empty. - // - // In some scenarios, multiple output audio fields may be present in the - // response structure. In these cases, only the top-most-level audio output - // has content. - bytes output_audio = 5; - - // The config used by the speech synthesizer to generate the output audio. - OutputAudioConfig output_audio_config = 6; -} - -// Contains a speech recognition result corresponding to a portion of the audio -// that is currently being processed or an indication that this is the end -// of the single requested utterance. -// -// Example: -// -// 1. transcript: "tube" -// -// 2. transcript: "to be a" -// -// 3. transcript: "to be" -// -// 4. transcript: "to be or not to be" -// is_final: true -// -// 5. transcript: " that's" -// -// 6. transcript: " that is" -// -// 7. message_type: `END_OF_SINGLE_UTTERANCE` -// -// 8. transcript: " that is the question" -// is_final: true -// -// Only two of the responses contain final results (#4 and #8 indicated by -// `is_final: true`). Concatenating these generates the full transcript: "to be -// or not to be that is the question". -// -// In each response we populate: -// -// * for `TRANSCRIPT`: `transcript` and possibly `is_final`. -// -// * for `END_OF_SINGLE_UTTERANCE`: only `message_type`. -message StreamingRecognitionResult { - // Type of the response message. - enum MessageType { - // Not specified. Should never be used. - MESSAGE_TYPE_UNSPECIFIED = 0; - - // Message contains a (possibly partial) transcript. - TRANSCRIPT = 1; - - // Message contains DTMF digits. When the client gets the message, it - // should stop sending additional data, half-close the gRPC connection, and - // wait for any additional results until the server closes the gRPC. - // connection. - DTMF_DIGITS = 3; - - // Event indicates that the server has detected the end of the user's speech - // utterance and expects no additional speech. Therefore, the server will - // not process additional audio (although it may subsequently return - // additional results). The client should stop sending additional audio - // data, half-close the gRPC connection, and wait for any additional results - // until the server closes the gRPC connection. This message is only sent if - // `single_utterance` was set to `true`, and is not used otherwise. - END_OF_SINGLE_UTTERANCE = 2; - - // Message contains DTMF digits. Before a message with DTMF_DIGITS is sent, - // a message with PARTIAL_DTMF_DIGITS may be sent with DTMF digits collected - // up to the time of sending, which represents an intermediate result. - PARTIAL_DTMF_DIGITS = 4; - } - - // Type of the result message. - MessageType message_type = 1; - - // Transcript text representing the words that the user spoke. - // Populated if and only if `message_type` = `TRANSCRIPT`. - string transcript = 2; - - // If `false`, the `StreamingRecognitionResult` represents an - // interim result that may change. If `true`, the recognizer will not return - // any further hypotheses about this piece of the audio. May only be populated - // for `message_type` = `TRANSCRIPT`. - bool is_final = 3; - - // The Speech confidence between 0.0 and 1.0 for the current portion of audio. - // A higher number indicates an estimated greater likelihood that the - // recognized words are correct. The default of 0.0 is a sentinel value - // indicating that confidence was not set. - // - // This field is typically only provided if `is_final` is true and you should - // not rely on it being accurate or even set. - float confidence = 4; - - // An estimate of the likelihood that the speech recognizer will - // not change its guess about this interim recognition result: - // - // * If the value is unspecified or 0.0, Dialogflow didn't compute the - // stability. In particular, Dialogflow will only provide stability for - // `TRANSCRIPT` results with `is_final = false`. - // * Otherwise, the value is in (0.0, 1.0] where 0.0 means completely - // unstable and 1.0 means completely stable. - float stability = 6; - - // Word-specific information for the words recognized by Speech in - // [transcript][google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.transcript]. Populated if and only if `message_type` = `TRANSCRIPT` and - // [InputAudioConfig.enable_word_info] is set. - repeated SpeechWordInfo speech_word_info = 7; - - // Time offset of the end of this Speech recognition result relative to the - // beginning of the audio. Only populated for `message_type` = `TRANSCRIPT`. - google.protobuf.Duration speech_end_offset = 8; - - // DTMF digits. Populated if and only if `message_type` = `DTMF_DIGITS`. - TelephonyDtmfEvents dtmf_digits = 5; -} - -// Represents the natural language text to be processed. -message TextInput { - // Required. The UTF-8 encoded natural language text to be processed. - // Text length must not exceed 256 characters. - string text = 1; - - // Required. The language of this conversational query. See [Language - // Support](https://cloud.google.com/dialogflow/docs/reference/language) - // for a list of the currently supported language codes. Note that queries in - // the same session do not necessarily need to specify the same language. - string language_code = 2; -} - -// Events allow for matching intents by event name instead of the natural -// language input. For instance, input `` can trigger a personalized welcome response. -// The parameter `name` may be used by the agent in the response: -// `"Hello #welcome_event.name! What can I do for you today?"`. -message EventInput { - // Required. The unique identifier of the event. - string name = 1; - - // The collection of parameters associated with the event. - // - // Depending on your protocol or client library language, this is a - // map, associative array, symbol table, dictionary, or JSON object - // composed of a collection of (MapKey, MapValue) pairs: - // - // - MapKey type: string - // - MapKey value: parameter name - // - MapValue type: - // - If parameter's entity type is a composite entity: map - // - Else: depending on parameter value type, could be one of string, - // number, boolean, null, list or map - // - MapValue value: - // - If parameter's entity type is a composite entity: - // map from composite entity property names to property values - // - Else: parameter value - google.protobuf.Struct parameters = 2; - - // Required. The language of this query. See [Language - // Support](https://cloud.google.com/dialogflow/docs/reference/language) - // for a list of the currently supported language codes. Note that queries in - // the same session do not necessarily need to specify the same language. - string language_code = 3; -} - -// Configures the types of sentiment analysis to perform. -message SentimentAnalysisRequestConfig { - // Instructs the service to perform sentiment analysis on - // `query_text`. If not provided, sentiment analysis is not performed on - // `query_text`. - bool analyze_query_text_sentiment = 1; -} - -// The result of sentiment analysis. Sentiment analysis inspects user input -// and identifies the prevailing subjective opinion, especially to determine a -// user's attitude as positive, negative, or neutral. -// For [Participants.DetectIntent][], it needs to be configured in -// [DetectIntentRequest.query_params][google.cloud.dialogflow.v2beta1.DetectIntentRequest.query_params]. For -// [Participants.StreamingDetectIntent][], it needs to be configured in -// [StreamingDetectIntentRequest.query_params][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_params]. -// And for [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] and -// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent], it needs to be configured in -// [ConversationProfile.human_agent_assistant_config][google.cloud.dialogflow.v2beta1.ConversationProfile.human_agent_assistant_config] -message SentimentAnalysisResult { - // The sentiment analysis result for `query_text`. - Sentiment query_text_sentiment = 1; -} - -// The sentiment, such as positive/negative feeling or association, for a unit -// of analysis, such as the query text. -message Sentiment { - // Sentiment score between -1.0 (negative sentiment) and 1.0 (positive - // sentiment). - float score = 1; - - // A non-negative number in the [0, +inf) range, which represents the absolute - // magnitude of sentiment, regardless of score (positive or negative). - float magnitude = 2; -} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto deleted file mode 100644 index c38902b3..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto +++ /dev/null @@ -1,351 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dialogflow/v2beta1/entity_type.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "SessionEntityTypeProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; - -// Service for managing [SessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityType]. -service SessionEntityTypes { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Returns the list of all session entity types in the specified session. - // - // This method doesn't work with Google Assistant integration. - // Contact Dialogflow support if you need to use session entities - // with Google Assistant integration. - rpc ListSessionEntityTypes(ListSessionEntityTypesRequest) returns (ListSessionEntityTypesResponse) { - option (google.api.http) = { - get: "/v2beta1/{parent=projects/*/agent/sessions/*}/entityTypes" - additional_bindings { - get: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes" - } - additional_bindings { - get: "/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/entityTypes" - } - additional_bindings { - get: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves the specified session entity type. - // - // This method doesn't work with Google Assistant integration. - // Contact Dialogflow support if you need to use session entities - // with Google Assistant integration. - rpc GetSessionEntityType(GetSessionEntityTypeRequest) returns (SessionEntityType) { - option (google.api.http) = { - get: "/v2beta1/{name=projects/*/agent/sessions/*/entityTypes/*}" - additional_bindings { - get: "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" - } - additional_bindings { - get: "/v2beta1/{name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" - } - additional_bindings { - get: "/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a session entity type. - // - // If the specified session entity type already exists, overrides the - // session entity type. - // - // This method doesn't work with Google Assistant integration. - // Contact Dialogflow support if you need to use session entities - // with Google Assistant integration. - rpc CreateSessionEntityType(CreateSessionEntityTypeRequest) returns (SessionEntityType) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*/agent/sessions/*}/entityTypes" - body: "session_entity_type" - additional_bindings { - post: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes" - body: "session_entity_type" - } - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/entityTypes" - body: "session_entity_type" - } - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes" - body: "session_entity_type" - } - }; - option (google.api.method_signature) = "parent,session_entity_type"; - } - - // Updates the specified session entity type. - // - // This method doesn't work with Google Assistant integration. - // Contact Dialogflow support if you need to use session entities - // with Google Assistant integration. - rpc UpdateSessionEntityType(UpdateSessionEntityTypeRequest) returns (SessionEntityType) { - option (google.api.http) = { - patch: "/v2beta1/{session_entity_type.name=projects/*/agent/sessions/*/entityTypes/*}" - body: "session_entity_type" - additional_bindings { - patch: "/v2beta1/{session_entity_type.name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" - body: "session_entity_type" - } - additional_bindings { - patch: "/v2beta1/{session_entity_type.name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" - body: "session_entity_type" - } - additional_bindings { - patch: "/v2beta1/{session_entity_type.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" - body: "session_entity_type" - } - }; - option (google.api.method_signature) = "session_entity_type"; - option (google.api.method_signature) = "session_entity_type,update_mask"; - } - - // Deletes the specified session entity type. - // - // This method doesn't work with Google Assistant integration. - // Contact Dialogflow support if you need to use session entities - // with Google Assistant integration. - rpc DeleteSessionEntityType(DeleteSessionEntityTypeRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2beta1/{name=projects/*/agent/sessions/*/entityTypes/*}" - additional_bindings { - delete: "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" - } - additional_bindings { - delete: "/v2beta1/{name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" - } - additional_bindings { - delete: "/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" - } - }; - option (google.api.method_signature) = "name"; - } -} - -// A session represents a conversation between a Dialogflow agent and an -// end-user. You can create special entities, called session entities, during a -// session. Session entities can extend or replace custom entity types and only -// exist during the session that they were created for. All session data, -// including session entities, is stored by Dialogflow for 20 minutes. -// -// For more information, see the [session entity -// guide](https://cloud.google.com/dialogflow/docs/entities-session). -message SessionEntityType { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/SessionEntityType" - pattern: "projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}" - pattern: "projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}" - pattern: "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}" - pattern: "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}" - }; - - // The types of modifications for a session entity type. - enum EntityOverrideMode { - // Not specified. This value should be never used. - ENTITY_OVERRIDE_MODE_UNSPECIFIED = 0; - - // The collection of session entities overrides the collection of entities - // in the corresponding custom entity type. - ENTITY_OVERRIDE_MODE_OVERRIDE = 1; - - // The collection of session entities extends the collection of entities in - // the corresponding custom entity type. - // - // Note: Even in this override mode calls to `ListSessionEntityTypes`, - // `GetSessionEntityType`, `CreateSessionEntityType` and - // `UpdateSessionEntityType` only return the additional entities added in - // this session entity type. If you want to get the supplemented list, - // please call [EntityTypes.GetEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType] on the custom entity type - // and merge. - ENTITY_OVERRIDE_MODE_SUPPLEMENT = 2; - } - - // Required. The unique identifier of this session entity type. Supported - // formats: - // - `projects//agent/sessions//entityTypes/` - // - `projects//locations//agent/sessions//entityTypes/` - // - `projects//agent/environments//users//sessions//entityTypes/` - // - `projects//locations//agent/environments/ - // /users//sessions//entityTypes/` - // - // If `Location ID` is not specified we assume default 'us' location. If - // `Environment ID` is not specified, we assume default 'draft' environment. - // If `User ID` is not specified, we assume default '-' user. - // `` must be the display name of an existing entity - // type in the same agent that will be overridden or supplemented. - string name = 1; - - // Required. Indicates whether the additional data should override or - // supplement the custom entity type definition. - EntityOverrideMode entity_override_mode = 2; - - // Required. The collection of entities associated with this session entity - // type. - repeated EntityType.Entity entities = 3; -} - -// The request message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes]. -message ListSessionEntityTypesRequest { - // Required. The session to list all session entity types from. - // Supported formats: - // - `projects//agent/sessions/, - // - `projects//locations//agent/sessions/`, - // - `projects//agent/environments//users//sessions/`, - // - `projects//locations//agent/environments//users//sessions/`, - // - // If `Location ID` is not specified we assume default 'us' location. If - // `Environment ID` is not specified, we assume default 'draft' environment. - // If `User ID` is not specified, we assume default '-' user. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/SessionEntityType" - } - ]; - - // Optional. The maximum number of items to return in a single page. By - // default 100 and at most 1000. - int32 page_size = 2; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 3; -} - -// The response message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes]. -message ListSessionEntityTypesResponse { - // The list of session entity types. There will be a maximum number of items - // returned based on the page_size field in the request. - repeated SessionEntityType session_entity_types = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request message for [SessionEntityTypes.GetSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityType]. -message GetSessionEntityTypeRequest { - // Required. The name of the session entity type. Supported formats: - // - `projects//agent/sessions//entityTypes/` - // - `projects//locations//agent/sessions//entityTypes/` - // - `projects//agent/environments//users//sessions//entityTypes/` - // - `projects//locations//agent/environments/ - // /users//sessions//entityTypes/` - // - // If `Location ID` is not specified we assume default 'us' location. If - // `Environment ID` is not specified, we assume default 'draft' environment. - // If `User ID` is not specified, we assume default '-' user. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/SessionEntityType" - } - ]; -} - -// The request message for [SessionEntityTypes.CreateSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityType]. -message CreateSessionEntityTypeRequest { - // Required. The session to create a session entity type for. - // Supported formats: - // - `projects//agent/sessions/, - // - `projects//locations//agent/sessions/`, - // - `projects//agent/environments//users//sessions/`, - // - `projects//locations//agent/environments//users//sessions/`, - // - // If `Location ID` is not specified we assume default 'us' location. If - // `Environment ID` is not specified, we assume default 'draft' environment. - // If `User ID` is not specified, we assume default '-' user. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/SessionEntityType" - } - ]; - - // Required. The session entity type to create. - SessionEntityType session_entity_type = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [SessionEntityTypes.UpdateSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.UpdateSessionEntityType]. -message UpdateSessionEntityTypeRequest { - // Required. The session entity type to update. - SessionEntityType session_entity_type = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 2; -} - -// The request message for [SessionEntityTypes.DeleteSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityType]. -message DeleteSessionEntityTypeRequest { - // Required. The name of the entity type to delete. - // Supported formats: - // - `projects//agent/sessions//entityTypes/` - // - `projects//locations//agent/sessions//entityTypes/` - // - `projects//agent/environments//users//sessions//entityTypes/` - // - `projects//locations//agent/environments/ - // /users//sessions//entityTypes/` - // - // If `Location ID` is not specified we assume default 'us' location. If - // `Environment ID` is not specified, we assume default 'draft' environment. - // If `User ID` is not specified, we assume default '-' user. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/SessionEntityType" - } - ]; -} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/validation_result.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/validation_result.proto deleted file mode 100644 index 2daeaf32..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/validation_result.proto +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/api/annotations.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "ValidationResultProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; - -// Represents a single validation error. -message ValidationError { - // Represents a level of severity. - enum Severity { - // Not specified. This value should never be used. - SEVERITY_UNSPECIFIED = 0; - - // The agent doesn't follow Dialogflow best practices. - INFO = 1; - - // The agent may not behave as expected. - WARNING = 2; - - // The agent may experience partial failures. - ERROR = 3; - - // The agent may completely fail. - CRITICAL = 4; - } - - // The severity of the error. - Severity severity = 1; - - // The names of the entries that the error is associated with. - // Format: - // - // - "projects//agent", if the error is associated with the entire - // agent. - // - "projects//agent/intents/", if the error is - // associated with certain intents. - // - "projects//agent/intents//trainingPhrases/", if the - // error is associated with certain intent training phrases. - // - "projects//agent/intents//parameters/", if the error is associated with certain intent parameters. - // - "projects//agent/entities/", if the error is - // associated with certain entities. - repeated string entries = 3; - - // The detailed error message. - string error_message = 4; -} - -// Represents the output of agent validation. -message ValidationResult { - // Contains all validation errors. - repeated ValidationError validation_errors = 1; -} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/version.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/version.proto deleted file mode 100644 index e3752610..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/version.proto +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "VersionProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; - -// Service for managing [Versions][google.cloud.dialogflow.v2beta1.Version]. -service Versions { - option (google.api.default_host) = "dialogflow.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/dialogflow"; - - // Returns the list of all versions of the specified agent. - rpc ListVersions(ListVersionsRequest) returns (ListVersionsResponse) { - option (google.api.http) = { - get: "/v2beta1/{parent=projects/*/agent}/versions" - additional_bindings { - get: "/v2beta1/{parent=projects/*/locations/*/agent}/versions" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves the specified agent version. - rpc GetVersion(GetVersionRequest) returns (Version) { - option (google.api.http) = { - get: "/v2beta1/{name=projects/*/agent/versions/*}" - additional_bindings { - get: "/v2beta1/{name=projects/*/locations/*/agent/versions/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates an agent version. - // - // The new version points to the agent instance in the "default" environment. - rpc CreateVersion(CreateVersionRequest) returns (Version) { - option (google.api.http) = { - post: "/v2beta1/{parent=projects/*/agent}/versions" - body: "version" - additional_bindings { - post: "/v2beta1/{parent=projects/*/locations/*/agent}/versions" - body: "version" - } - }; - option (google.api.method_signature) = "parent,version"; - } - - // Updates the specified agent version. - // - // Note that this method does not allow you to update the state of the agent - // the given version points to. It allows you to update only mutable - // properties of the version resource. - rpc UpdateVersion(UpdateVersionRequest) returns (Version) { - option (google.api.http) = { - patch: "/v2beta1/{version.name=projects/*/agent/versions/*}" - body: "version" - additional_bindings { - patch: "/v2beta1/{version.name=projects/*/locations/*/agent/versions/*}" - body: "version" - } - }; - option (google.api.method_signature) = "version,update_mask"; - } - - // Delete the specified agent version. - rpc DeleteVersion(DeleteVersionRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2beta1/{name=projects/*/agent/versions/*}" - additional_bindings { - delete: "/v2beta1/{name=projects/*/locations/*/agent/versions/*}" - } - }; - option (google.api.method_signature) = "name"; - } -} - -// You can create multiple versions of your agent and publish them to separate -// environments. -// -// When you edit an agent, you are editing the draft agent. At any point, you -// can save the draft agent as an agent version, which is an immutable snapshot -// of your agent. -// -// When you save the draft agent, it is published to the default environment. -// When you create agent versions, you can publish them to custom environments. -// You can create a variety of custom environments for: -// -// - testing -// - development -// - production -// - etc. -// -// For more information, see the [versions and environments -// guide](https://cloud.google.com/dialogflow/docs/agents-versions). -message Version { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/Version" - pattern: "projects/{project}/agent/versions/{version}" - pattern: "projects/{project}/locations/{location}/agent/versions/{version}" - }; - - // The status of a version. - enum VersionStatus { - // Not specified. This value is not used. - VERSION_STATUS_UNSPECIFIED = 0; - - // Version is not ready to serve (e.g. training is in progress). - IN_PROGRESS = 1; - - // Version is ready to serve. - READY = 2; - - // Version training failed. - FAILED = 3; - } - - // Output only. The unique identifier of this agent version. - // Supported formats: - // - `projects//agent/versions/` - // - `projects//locations//agent/versions/` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The developer-provided description of this version. - string description = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The sequential number of this version. This field is read-only which means - // it cannot be set by create and update methods. - int32 version_number = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The creation time of this version. This field is read-only, i.e., it cannot - // be set by create and update methods. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The status of this version. This field is read-only and cannot be set by - // create and update methods. - VersionStatus status = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The request message for [Versions.ListVersions][google.cloud.dialogflow.v2beta1.Versions.ListVersions]. -message ListVersionsRequest { - // Required. The agent to list all versions from. - // Supported formats: - // - `projects//agent` - // - `projects//locations//agent` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Version" - } - ]; - - // Optional. The maximum number of items to return in a single page. By default 100 and - // at most 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The next_page_token value returned from a previous list request. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response message for [Versions.ListVersions][google.cloud.dialogflow.v2beta1.Versions.ListVersions]. -message ListVersionsResponse { - // The list of agent versions. There will be a maximum number of items - // returned based on the page_size field in the request. - repeated Version versions = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// The request message for [Versions.GetVersion][google.cloud.dialogflow.v2beta1.Versions.GetVersion]. -message GetVersionRequest { - // Required. The name of the version. - // Supported formats: - // - `projects//agent/versions/` - // - `projects//locations//agent/versions/` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Version" - } - ]; -} - -// The request message for [Versions.CreateVersion][google.cloud.dialogflow.v2beta1.Versions.CreateVersion]. -message CreateVersionRequest { - // Required. The agent to create a version for. - // Supported formats: - // - `projects//agent` - // - `projects//locations//agent` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/Version" - } - ]; - - // Required. The version to create. - Version version = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [Versions.UpdateVersion][google.cloud.dialogflow.v2beta1.Versions.UpdateVersion]. -message UpdateVersionRequest { - // Required. The version to update. - // Supported formats: - // - `projects//agent/versions/` - // - `projects//locations//agent/versions/` - Version version = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [Versions.DeleteVersion][google.cloud.dialogflow.v2beta1.Versions.DeleteVersion]. -message DeleteVersionRequest { - // Required. The name of the version to delete. - // Supported formats: - // - `projects//agent/versions/` - // - `projects//locations//agent/versions/` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Version" - } - ]; -} diff --git a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/webhook.proto b/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/webhook.proto deleted file mode 100644 index 64c7efda..00000000 --- a/owl-bot-staging/v2beta1/protos/google/cloud/dialogflow/v2beta1/webhook.proto +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dialogflow.v2beta1; - -import "google/cloud/dialogflow/v2beta1/context.proto"; -import "google/cloud/dialogflow/v2beta1/intent.proto"; -import "google/cloud/dialogflow/v2beta1/session.proto"; -import "google/cloud/dialogflow/v2beta1/session_entity_type.proto"; -import "google/protobuf/struct.proto"; -import "google/api/annotations.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "WebhookProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; - -// The request message for a webhook call. -message WebhookRequest { - // The unique identifier of detectIntent request session. - // Can be used to identify end-user inside webhook implementation. - // Supported formats: - // - `projects//agent/sessions/, - // - `projects//locations//agent/sessions/`, - // - `projects//agent/environments//users//sessions/`, - // - `projects//locations//agent/environments//users//sessions/`, - string session = 4; - - // The unique identifier of the response. Contains the same value as - // `[Streaming]DetectIntentResponse.response_id`. - string response_id = 1; - - // The result of the conversational query or event processing. Contains the - // same value as `[Streaming]DetectIntentResponse.query_result`. - QueryResult query_result = 2; - - // Alternative query results from KnowledgeService. - repeated QueryResult alternative_query_results = 5; - - // Optional. The contents of the original request that was passed to - // `[Streaming]DetectIntent` call. - OriginalDetectIntentRequest original_detect_intent_request = 3; -} - -// The response message for a webhook call. -// -// This response is validated by the Dialogflow server. If validation fails, -// an error will be returned in the [QueryResult.diagnostic_info][google.cloud.dialogflow.v2beta1.QueryResult.diagnostic_info] field. -// Setting JSON fields to an empty value with the wrong type is a common error. -// To avoid this error: -// -// - Use `""` for empty strings -// - Use `{}` or `null` for empty objects -// - Use `[]` or `null` for empty arrays -// -// For more information, see the -// [Protocol Buffers Language -// Guide](https://developers.google.com/protocol-buffers/docs/proto3#json). -message WebhookResponse { - // Optional. The text response message intended for the end-user. - // It is recommended to use `fulfillment_messages.text.text[0]` instead. - // When provided, Dialogflow uses this field to populate - // [QueryResult.fulfillment_text][google.cloud.dialogflow.v2beta1.QueryResult.fulfillment_text] sent to the integration or API caller. - string fulfillment_text = 1; - - // Optional. The rich response messages intended for the end-user. - // When provided, Dialogflow uses this field to populate - // [QueryResult.fulfillment_messages][google.cloud.dialogflow.v2beta1.QueryResult.fulfillment_messages] sent to the integration or API caller. - repeated Intent.Message fulfillment_messages = 2; - - // Optional. A custom field used to identify the webhook source. - // Arbitrary strings are supported. - // When provided, Dialogflow uses this field to populate - // [QueryResult.webhook_source][google.cloud.dialogflow.v2beta1.QueryResult.webhook_source] sent to the integration or API caller. - string source = 3; - - // Optional. This field can be used to pass custom data from your webhook to the - // integration or API caller. Arbitrary JSON objects are supported. - // When provided, Dialogflow uses this field to populate - // [QueryResult.webhook_payload][google.cloud.dialogflow.v2beta1.QueryResult.webhook_payload] sent to the integration or API caller. - // This field is also used by the - // [Google Assistant - // integration](https://cloud.google.com/dialogflow/docs/integrations/aog) - // for rich response messages. - // See the format definition at [Google Assistant Dialogflow webhook - // format](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json) - google.protobuf.Struct payload = 4; - - // Optional. The collection of output contexts that will overwrite currently - // active contexts for the session and reset their lifespans. - // When provided, Dialogflow uses this field to populate - // [QueryResult.output_contexts][google.cloud.dialogflow.v2beta1.QueryResult.output_contexts] sent to the integration or API caller. - repeated Context output_contexts = 5; - - // Optional. Invokes the supplied events. - // When this field is set, Dialogflow ignores the `fulfillment_text`, - // `fulfillment_messages`, and `payload` fields. - EventInput followup_event_input = 6; - - // Indicates that a live agent should be brought in to handle the - // interaction with the user. In most cases, when you set this flag to true, - // you would also want to set end_interaction to true as well. Default is - // false. - bool live_agent_handoff = 7; - - // Optional. Indicates that this intent ends an interaction. Some integrations - // (e.g., Actions on Google or Dialogflow phone gateway) use this information - // to close interaction with an end user. Default is false. - bool end_interaction = 8; - - // Optional. Additional session entity types to replace or extend developer - // entity types with. The entity synonyms apply to all languages and persist - // for the session. Setting this data from a webhook overwrites - // the session entity types that have been set using `detectIntent`, - // `streamingDetectIntent` or [SessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityType] management methods. - repeated SessionEntityType session_entity_types = 10; -} - -// Represents the contents of the original request that was passed to -// the `[Streaming]DetectIntent` call. -message OriginalDetectIntentRequest { - // The source of this request, e.g., `google`, `facebook`, `slack`. It is set - // by Dialogflow-owned servers. - string source = 1; - - // Optional. The version of the protocol used for this request. - // This field is AoG-specific. - string version = 2; - - // Optional. This field is set to the value of the `QueryParameters.payload` - // field passed in the request. Some integrations that query a Dialogflow - // agent may provide additional information in the payload. - // - // In particular, for the Dialogflow Phone Gateway integration, this field has - // the form: - //
{
-  //  "telephony": {
-  //    "caller_id": "+18558363987"
-  //  }
-  // }
- // Note: The caller ID field (`caller_id`) will be redacted for Trial - // Edition agents and populated with the caller ID in [E.164 - // format](https://en.wikipedia.org/wiki/E.164) for Essentials Edition agents. - google.protobuf.Struct payload = 3; -} diff --git a/owl-bot-staging/v2beta1/src/index.ts b/owl-bot-staging/v2beta1/src/index.ts deleted file mode 100644 index 19b00df5..00000000 --- a/owl-bot-staging/v2beta1/src/index.ts +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v2beta1 from './v2beta1'; -const AgentsClient = v2beta1.AgentsClient; -type AgentsClient = v2beta1.AgentsClient; -const AnswerRecordsClient = v2beta1.AnswerRecordsClient; -type AnswerRecordsClient = v2beta1.AnswerRecordsClient; -const ContextsClient = v2beta1.ContextsClient; -type ContextsClient = v2beta1.ContextsClient; -const ConversationProfilesClient = v2beta1.ConversationProfilesClient; -type ConversationProfilesClient = v2beta1.ConversationProfilesClient; -const ConversationsClient = v2beta1.ConversationsClient; -type ConversationsClient = v2beta1.ConversationsClient; -const DocumentsClient = v2beta1.DocumentsClient; -type DocumentsClient = v2beta1.DocumentsClient; -const EntityTypesClient = v2beta1.EntityTypesClient; -type EntityTypesClient = v2beta1.EntityTypesClient; -const EnvironmentsClient = v2beta1.EnvironmentsClient; -type EnvironmentsClient = v2beta1.EnvironmentsClient; -const FulfillmentsClient = v2beta1.FulfillmentsClient; -type FulfillmentsClient = v2beta1.FulfillmentsClient; -const IntentsClient = v2beta1.IntentsClient; -type IntentsClient = v2beta1.IntentsClient; -const KnowledgeBasesClient = v2beta1.KnowledgeBasesClient; -type KnowledgeBasesClient = v2beta1.KnowledgeBasesClient; -const ParticipantsClient = v2beta1.ParticipantsClient; -type ParticipantsClient = v2beta1.ParticipantsClient; -const SessionEntityTypesClient = v2beta1.SessionEntityTypesClient; -type SessionEntityTypesClient = v2beta1.SessionEntityTypesClient; -const SessionsClient = v2beta1.SessionsClient; -type SessionsClient = v2beta1.SessionsClient; -const VersionsClient = v2beta1.VersionsClient; -type VersionsClient = v2beta1.VersionsClient; -export {v2beta1, AgentsClient, AnswerRecordsClient, ContextsClient, ConversationProfilesClient, ConversationsClient, DocumentsClient, EntityTypesClient, EnvironmentsClient, FulfillmentsClient, IntentsClient, KnowledgeBasesClient, ParticipantsClient, SessionEntityTypesClient, SessionsClient, VersionsClient}; -export default {v2beta1, AgentsClient, AnswerRecordsClient, ContextsClient, ConversationProfilesClient, ConversationsClient, DocumentsClient, EntityTypesClient, EnvironmentsClient, FulfillmentsClient, IntentsClient, KnowledgeBasesClient, ParticipantsClient, SessionEntityTypesClient, SessionsClient, VersionsClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/agents_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/agents_client.ts deleted file mode 100644 index a3c8a4b5..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/agents_client.ts +++ /dev/null @@ -1,3088 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2beta1/agents_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './agents_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2beta1.Agent|Agents}. - * @class - * @memberof v2beta1 - */ -export class AgentsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - agentsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AgentsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof AgentsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - searchAgents: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'agents') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - - this.operationsClient = this._gaxModule.lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }).operationsClient(opts); - const trainAgentResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const trainAgentMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - const exportAgentResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2beta1.ExportAgentResponse') as gax.protobuf.Type; - const exportAgentMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - const importAgentResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const importAgentMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - const restoreAgentResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const restoreAgentMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - - this.descriptors.longrunning = { - trainAgent: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - trainAgentResponse.decode.bind(trainAgentResponse), - trainAgentMetadata.decode.bind(trainAgentMetadata)), - exportAgent: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportAgentResponse.decode.bind(exportAgentResponse), - exportAgentMetadata.decode.bind(exportAgentMetadata)), - importAgent: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - importAgentResponse.decode.bind(importAgentResponse), - importAgentMetadata.decode.bind(importAgentMetadata)), - restoreAgent: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - restoreAgentResponse.decode.bind(restoreAgentResponse), - restoreAgentMetadata.decode.bind(restoreAgentMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2beta1.Agents', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.agentsStub) { - return this.agentsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2beta1.Agents. - this.agentsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.Agents') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2beta1.Agents, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const agentsStubMethods = - ['getAgent', 'setAgent', 'deleteAgent', 'searchAgents', 'trainAgent', 'exportAgent', 'importAgent', 'restoreAgent', 'getValidationResult']; - for (const methodName of agentsStubMethods) { - const callPromise = this.agentsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.agentsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getAgent( - request?: protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IAgent, - protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest|undefined, {}|undefined - ]>; - getAgent( - request: protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IAgent, - protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest|null|undefined, - {}|null|undefined>): void; - getAgent( - request: protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IAgent, - protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specified agent. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project that the agent to fetch is associated with. - * Format: `projects/` or - * `projects//locations/`. - * @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. - * The first element of the array is an object representing [Agent]{@link google.cloud.dialogflow.v2beta1.Agent}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getAgent(request); - */ - getAgent( - request?: protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IAgent, - protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IAgent, - protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IAgent, - protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.getAgent(request, options, callback); - } - setAgent( - request?: protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IAgent, - protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest|undefined, {}|undefined - ]>; - setAgent( - request: protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IAgent, - protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest|null|undefined, - {}|null|undefined>): void; - setAgent( - request: protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IAgent, - protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates/updates the specified agent. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2beta1.Agent} request.agent - * Required. The agent to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Optional. The mask to control which fields get updated. - * @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. - * The first element of the array is an object representing [Agent]{@link google.cloud.dialogflow.v2beta1.Agent}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.setAgent(request); - */ - setAgent( - request?: protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IAgent, - protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IAgent, - protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IAgent, - protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'agent.parent': request.agent!.parent || '', - }); - this.initialize(); - return this.innerApiCalls.setAgent(request, options, callback); - } - deleteAgent( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest|undefined, {}|undefined - ]>; - deleteAgent( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest|null|undefined, - {}|null|undefined>): void; - deleteAgent( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deletes the specified agent. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project that the agent to delete is associated with. - * Format: `projects/` or - * `projects//locations/`. - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteAgent(request); - */ - deleteAgent( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.deleteAgent(request, options, callback); - } - getValidationResult( - request?: protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IValidationResult, - protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest|undefined, {}|undefined - ]>; - getValidationResult( - request: protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IValidationResult, - protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest|null|undefined, - {}|null|undefined>): void; - getValidationResult( - request: protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IValidationResult, - protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest|null|undefined, - {}|null|undefined>): void; -/** - * Gets agent validation result. Agent validation is performed during - * training time and is updated automatically when training is completed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project that the agent is associated with. - * Format: `projects/` or - * `projects//locations/`. - * @param {string} [request.languageCode] - * Optional. The language for which you want a validation result. If not - * specified, the agent's default language is used. [Many - * languages](https://cloud.google.com/dialogflow/docs/reference/language) - * are supported. Note: languages must be enabled in the agent before they can - * be used. - * @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. - * The first element of the array is an object representing [ValidationResult]{@link google.cloud.dialogflow.v2beta1.ValidationResult}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getValidationResult(request); - */ - getValidationResult( - request?: protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IValidationResult, - protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IValidationResult, - protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IValidationResult, - protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.getValidationResult(request, options, callback); - } - - trainAgent( - request?: protos.google.cloud.dialogflow.v2beta1.ITrainAgentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - trainAgent( - request: protos.google.cloud.dialogflow.v2beta1.ITrainAgentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - trainAgent( - request: protos.google.cloud.dialogflow.v2beta1.ITrainAgentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Trains the specified agent. - * - * - * Operation - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project that the agent to train is associated with. - * Format: `projects/` or - * `projects//locations/`. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.trainAgent(request); - * const [response] = await operation.promise(); - */ - trainAgent( - request?: protos.google.cloud.dialogflow.v2beta1.ITrainAgentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.trainAgent(request, options, callback); - } -/** - * Check the status of the long running operation returned by `trainAgent()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkTrainAgentProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkTrainAgentProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.trainAgent, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - exportAgent( - request?: protos.google.cloud.dialogflow.v2beta1.IExportAgentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportAgent( - request: protos.google.cloud.dialogflow.v2beta1.IExportAgentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportAgent( - request: protos.google.cloud.dialogflow.v2beta1.IExportAgentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Exports the specified agent to a ZIP file. - * - * - * Operation - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project that the agent to export is associated with. - * Format: `projects/` or - * `projects//locations/`. - * @param {string} request.agentUri - * Optional. The - * [Google Cloud Storage](https://cloud.google.com/storage/docs/) - * URI to export the agent to. - * The format of this URI must be `gs:///`. - * If left unspecified, the serialized agent is returned inline. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.exportAgent(request); - * const [response] = await operation.promise(); - */ - exportAgent( - request?: protos.google.cloud.dialogflow.v2beta1.IExportAgentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.exportAgent(request, options, callback); - } -/** - * Check the status of the long running operation returned by `exportAgent()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkExportAgentProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkExportAgentProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.exportAgent, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - importAgent( - request?: protos.google.cloud.dialogflow.v2beta1.IImportAgentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - importAgent( - request: protos.google.cloud.dialogflow.v2beta1.IImportAgentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importAgent( - request: protos.google.cloud.dialogflow.v2beta1.IImportAgentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Imports the specified agent from a ZIP file. - * - * Uploads new intents and entity types without deleting the existing ones. - * Intents and entity types with the same name are replaced with the new - * versions from {@link google.cloud.dialogflow.v2beta1.ImportAgentRequest|ImportAgentRequest}. After the import, the imported draft - * agent will be trained automatically (unless disabled in agent settings). - * However, once the import is done, training may not be completed yet. Please - * call {@link google.cloud.dialogflow.v2beta1.Agents.TrainAgent|TrainAgent} and wait for the operation it returns in order to train - * explicitly. - * - * - * Operation - * An operation which tracks when importing is complete. It only tracks - * when the draft agent is updated not when it is done training. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project that the agent to import is associated with. - * Format: `projects/` or - * `projects//locations/`. - * @param {string} request.agentUri - * The URI to a Google Cloud Storage file containing the agent to import. - * Note: The URI must start with "gs://". - * @param {Buffer} request.agentContent - * Zip compressed raw byte content for agent. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.importAgent(request); - * const [response] = await operation.promise(); - */ - importAgent( - request?: protos.google.cloud.dialogflow.v2beta1.IImportAgentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.importAgent(request, options, callback); - } -/** - * Check the status of the long running operation returned by `importAgent()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkImportAgentProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkImportAgentProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.importAgent, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - restoreAgent( - request?: protos.google.cloud.dialogflow.v2beta1.IRestoreAgentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - restoreAgent( - request: protos.google.cloud.dialogflow.v2beta1.IRestoreAgentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreAgent( - request: protos.google.cloud.dialogflow.v2beta1.IRestoreAgentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Restores the specified agent from a ZIP file. - * - * Replaces the current agent version with a new one. All the intents and - * entity types in the older version are deleted. After the restore, the - * restored draft agent will be trained automatically (unless disabled in - * agent settings). However, once the restore is done, training may not be - * completed yet. Please call {@link google.cloud.dialogflow.v2beta1.Agents.TrainAgent|TrainAgent} and wait for the operation it - * returns in order to train explicitly. - * - * - * Operation - * An operation which tracks when restoring is complete. It only tracks - * when the draft agent is updated not when it is done training. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project that the agent to restore is associated with. - * Format: `projects/` or - * `projects//locations/`. - * @param {string} request.agentUri - * The URI to a Google Cloud Storage file containing the agent to restore. - * Note: The URI must start with "gs://". - * @param {Buffer} request.agentContent - * Zip compressed raw byte content for agent. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.restoreAgent(request); - * const [response] = await operation.promise(); - */ - restoreAgent( - request?: protos.google.cloud.dialogflow.v2beta1.IRestoreAgentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.restoreAgent(request, options, callback); - } -/** - * Check the status of the long running operation returned by `restoreAgent()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkRestoreAgentProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkRestoreAgentProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.restoreAgent, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - searchAgents( - request?: protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IAgent[], - protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest|null, - protos.google.cloud.dialogflow.v2beta1.ISearchAgentsResponse - ]>; - searchAgents( - request: protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, - protos.google.cloud.dialogflow.v2beta1.ISearchAgentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IAgent>): void; - searchAgents( - request: protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, - protos.google.cloud.dialogflow.v2beta1.ISearchAgentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IAgent>): void; -/** - * Returns the list of agents. - * Since there is at most one conversational agent per project, this method is - * useful primarily for listing all agents across projects the caller has - * access to. One can achieve that with a wildcard project collection id "-". - * Refer to [List - * Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list agents from. - * Format: `projects/` or - * `projects//locations/`. - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [Agent]{@link google.cloud.dialogflow.v2beta1.Agent}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `searchAgentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - searchAgents( - request?: protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, - protos.google.cloud.dialogflow.v2beta1.ISearchAgentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IAgent>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, - protos.google.cloud.dialogflow.v2beta1.ISearchAgentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IAgent>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IAgent[], - protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest|null, - protos.google.cloud.dialogflow.v2beta1.ISearchAgentsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.searchAgents(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list agents from. - * Format: `projects/` or - * `projects//locations/`. - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Agent]{@link google.cloud.dialogflow.v2beta1.Agent} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `searchAgentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - searchAgentsStream( - request?: protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.searchAgents.createStream( - this.innerApiCalls.searchAgents as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `searchAgents`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list agents from. - * Format: `projects/` or - * `projects//locations/`. - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Agent]{@link google.cloud.dialogflow.v2beta1.Agent}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.searchAgentsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - searchAgentsAsync( - request?: protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.searchAgents.asyncIterate( - this.innerApiCalls['searchAgents'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.agentsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/agents_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/agents_client_config.json deleted file mode 100644 index b73a09e5..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/agents_client_config.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2beta1.Agents": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetAgent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "SetAgent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteAgent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "SearchAgents": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "TrainAgent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ExportAgent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ImportAgent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "RestoreAgent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetValidationResult": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/agents_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/agents_proto_list.json deleted file mode 100644 index cb5136f1..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/agents_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2beta1/context.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2beta1/document.proto", - "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", - "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2beta1/version.proto", - "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" -] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/answer_records_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/answer_records_client.ts deleted file mode 100644 index 7dec94ba..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/answer_records_client.ts +++ /dev/null @@ -1,2463 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2beta1/answer_records_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './answer_records_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2beta1.AnswerRecord|AnswerRecords}. - * @class - * @memberof v2beta1 - */ -export class AnswerRecordsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - answerRecordsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AnswerRecordsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof AnswerRecordsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listAnswerRecords: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'answerRecords') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2beta1.AnswerRecords', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.answerRecordsStub) { - return this.answerRecordsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2beta1.AnswerRecords. - this.answerRecordsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.AnswerRecords') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2beta1.AnswerRecords, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const answerRecordsStubMethods = - ['getAnswerRecord', 'listAnswerRecords', 'updateAnswerRecord']; - for (const methodName of answerRecordsStubMethods) { - const callPromise = this.answerRecordsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.answerRecordsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getAnswerRecord( - request?: protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, - protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest|undefined, {}|undefined - ]>; - getAnswerRecord( - request: protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, - protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest|null|undefined, - {}|null|undefined>): void; - getAnswerRecord( - request: protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, - protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deprecated. - * Retrieves a specific answer record. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the answer record to retrieve. - * Format: `projects//locations//answerRecords/`. - * @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. - * The first element of the array is an object representing [AnswerRecord]{@link google.cloud.dialogflow.v2beta1.AnswerRecord}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getAnswerRecord(request); - * @deprecated GetAnswerRecord is deprecated and may be removed in a future version. - */ - getAnswerRecord( - request?: protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, - protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, - protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, - protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - this.warn('DEP$AnswerRecords-$GetAnswerRecord','GetAnswerRecord is deprecated and may be removed in a future version.', 'DeprecationWarning'); - return this.innerApiCalls.getAnswerRecord(request, options, callback); - } - updateAnswerRecord( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, - protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest|undefined, {}|undefined - ]>; - updateAnswerRecord( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, - protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest|null|undefined, - {}|null|undefined>): void; - updateAnswerRecord( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, - protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified answer record. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2beta1.AnswerRecord} request.answerRecord - * Required. Answer record to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The mask to control which fields get updated. - * @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. - * The first element of the array is an object representing [AnswerRecord]{@link google.cloud.dialogflow.v2beta1.AnswerRecord}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateAnswerRecord(request); - */ - updateAnswerRecord( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, - protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, - protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, - protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'answer_record.name': request.answerRecord!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateAnswerRecord(request, options, callback); - } - - listAnswerRecords( - request?: protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IAnswerRecord[], - protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse - ]>; - listAnswerRecords( - request: protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, - protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IAnswerRecord>): void; - listAnswerRecords( - request: protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, - protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IAnswerRecord>): void; -/** - * Returns the list of all answer records in the specified project in reverse - * chronological order. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list all answer records for in reverse - * chronological order. Format: `projects//locations/`. - * @param {number} request.pageSize - * Optional. The maximum number of records to return in a single page. - * The server may return fewer records than this. If unspecified, we use 10. - * The maximum is 100. - * @param {string} request.pageToken - * Optional. The - * {@link google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse.next_page_token|ListAnswerRecordsResponse.next_page_token} - * value returned from a previous list request used to continue listing on - * the next page. - * @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. - * The first element of the array is Array of [AnswerRecord]{@link google.cloud.dialogflow.v2beta1.AnswerRecord}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listAnswerRecordsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAnswerRecords( - request?: protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, - protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IAnswerRecord>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, - protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IAnswerRecord>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IAnswerRecord[], - protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listAnswerRecords(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list all answer records for in reverse - * chronological order. Format: `projects//locations/`. - * @param {number} request.pageSize - * Optional. The maximum number of records to return in a single page. - * The server may return fewer records than this. If unspecified, we use 10. - * The maximum is 100. - * @param {string} request.pageToken - * Optional. The - * {@link google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse.next_page_token|ListAnswerRecordsResponse.next_page_token} - * value returned from a previous list request used to continue listing on - * the next page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [AnswerRecord]{@link google.cloud.dialogflow.v2beta1.AnswerRecord} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listAnswerRecordsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAnswerRecordsStream( - request?: protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listAnswerRecords.createStream( - this.innerApiCalls.listAnswerRecords as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAnswerRecords`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list all answer records for in reverse - * chronological order. Format: `projects//locations/`. - * @param {number} request.pageSize - * Optional. The maximum number of records to return in a single page. - * The server may return fewer records than this. If unspecified, we use 10. - * The maximum is 100. - * @param {string} request.pageToken - * Optional. The - * {@link google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse.next_page_token|ListAnswerRecordsResponse.next_page_token} - * value returned from a previous list request used to continue listing on - * the next page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [AnswerRecord]{@link google.cloud.dialogflow.v2beta1.AnswerRecord}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listAnswerRecordsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listAnswerRecordsAsync( - request?: protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listAnswerRecords.asyncIterate( - this.innerApiCalls['listAnswerRecords'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.answerRecordsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/answer_records_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/answer_records_client_config.json deleted file mode 100644 index 34e2ae76..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/answer_records_client_config.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2beta1.AnswerRecords": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetAnswerRecord": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ListAnswerRecords": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateAnswerRecord": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/answer_records_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/answer_records_proto_list.json deleted file mode 100644 index cb5136f1..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/answer_records_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2beta1/context.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2beta1/document.proto", - "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", - "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2beta1/version.proto", - "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" -] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/contexts_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/contexts_client.ts deleted file mode 100644 index 48699b0b..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/contexts_client.ts +++ /dev/null @@ -1,2781 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2beta1/contexts_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './contexts_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2beta1.Context|Contexts}. - * @class - * @memberof v2beta1 - */ -export class ContextsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - contextsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ContextsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ContextsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listContexts: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'contexts') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2beta1.Contexts', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.contextsStub) { - return this.contextsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2beta1.Contexts. - this.contextsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.Contexts') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2beta1.Contexts, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const contextsStubMethods = - ['listContexts', 'getContext', 'createContext', 'updateContext', 'deleteContext', 'deleteAllContexts']; - for (const methodName of contextsStubMethods) { - const callPromise = this.contextsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.contextsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getContext( - request?: protos.google.cloud.dialogflow.v2beta1.IGetContextRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IContext, - protos.google.cloud.dialogflow.v2beta1.IGetContextRequest|undefined, {}|undefined - ]>; - getContext( - request: protos.google.cloud.dialogflow.v2beta1.IGetContextRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IContext, - protos.google.cloud.dialogflow.v2beta1.IGetContextRequest|null|undefined, - {}|null|undefined>): void; - getContext( - request: protos.google.cloud.dialogflow.v2beta1.IGetContextRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IContext, - protos.google.cloud.dialogflow.v2beta1.IGetContextRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specified context. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the context. Supported formats: - * - `projects//agent/sessions//contexts/`, - * - `projects//locations//agent/sessions//contexts/`, - * - `projects//agent/environments//users//sessions//contexts/`, - * - `projects//locations//agent/environments//users//sessions//contexts/`, - * - * If `Location ID` is not specified we assume default 'us' location. If - * `Environment ID` is not specified, we assume default 'draft' environment. - * If `User ID` is not specified, we assume default '-' user. - * @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. - * The first element of the array is an object representing [Context]{@link google.cloud.dialogflow.v2beta1.Context}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getContext(request); - */ - getContext( - request?: protos.google.cloud.dialogflow.v2beta1.IGetContextRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IContext, - protos.google.cloud.dialogflow.v2beta1.IGetContextRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IContext, - protos.google.cloud.dialogflow.v2beta1.IGetContextRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IContext, - protos.google.cloud.dialogflow.v2beta1.IGetContextRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getContext(request, options, callback); - } - createContext( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IContext, - protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest|undefined, {}|undefined - ]>; - createContext( - request: protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IContext, - protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest|null|undefined, - {}|null|undefined>): void; - createContext( - request: protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IContext, - protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates a context. - * - * If the specified context already exists, overrides the context. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The session to create a context for. Supported formats: - * - `projects//agent/sessions/, - * - `projects//locations//agent/sessions/`, - * - `projects//agent/environments//users//sessions/`, - * - `projects//locations//agent/environments//users//sessions/`, - * - * If `Location ID` is not specified we assume default 'us' location. If - * `Environment ID` is not specified, we assume default 'draft' environment. - * If `User ID` is not specified, we assume default '-' user. - * @param {google.cloud.dialogflow.v2beta1.Context} request.context - * Required. The context to create. - * @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. - * The first element of the array is an object representing [Context]{@link google.cloud.dialogflow.v2beta1.Context}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createContext(request); - */ - createContext( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IContext, - protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IContext, - protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IContext, - protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createContext(request, options, callback); - } - updateContext( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IContext, - protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest|undefined, {}|undefined - ]>; - updateContext( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IContext, - protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest|null|undefined, - {}|null|undefined>): void; - updateContext( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IContext, - protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified context. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2beta1.Context} request.context - * Required. The context to update. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The mask to control which fields get updated. - * @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. - * The first element of the array is an object representing [Context]{@link google.cloud.dialogflow.v2beta1.Context}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateContext(request); - */ - updateContext( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IContext, - protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IContext, - protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IContext, - protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'context.name': request.context!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateContext(request, options, callback); - } - deleteContext( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest|undefined, {}|undefined - ]>; - deleteContext( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest|null|undefined, - {}|null|undefined>): void; - deleteContext( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deletes the specified context. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the context to delete. Supported formats: - * - `projects//agent/sessions//contexts/`, - * - `projects//locations//agent/sessions//contexts/`, - * - `projects//agent/environments//users//sessions//contexts/`, - * - `projects//locations//agent/environments//users//sessions//contexts/`, - * - * If `Location ID` is not specified we assume default 'us' location. If - * `Environment ID` is not specified, we assume default 'draft' environment. - * If `User ID` is not specified, we assume default '-' user. - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteContext(request); - */ - deleteContext( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteContext(request, options, callback); - } - deleteAllContexts( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest|undefined, {}|undefined - ]>; - deleteAllContexts( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest|null|undefined, - {}|null|undefined>): void; - deleteAllContexts( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deletes all active contexts in the specified session. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the session to delete all contexts from. Supported formats: - * - `projects//agent/sessions/, - * - `projects//locations//agent/sessions/`, - * - `projects//agent/environments//users//sessions/`, - * - `projects//locations//agent/environments//users//sessions/`, - * - * If `Location ID` is not specified we assume default 'us' location. If - * `Environment ID` is not specified we assume default 'draft' environment. If - * `User ID` is not specified, we assume default '-' user. - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteAllContexts(request); - */ - deleteAllContexts( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.deleteAllContexts(request, options, callback); - } - - listContexts( - request?: protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IContext[], - protos.google.cloud.dialogflow.v2beta1.IListContextsRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListContextsResponse - ]>; - listContexts( - request: protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, - protos.google.cloud.dialogflow.v2beta1.IListContextsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IContext>): void; - listContexts( - request: protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, - protos.google.cloud.dialogflow.v2beta1.IListContextsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IContext>): void; -/** - * Returns the list of all contexts in the specified session. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The session to list all contexts from. Supported formats: - * - `projects//agent/sessions/, - * - `projects//locations//agent/sessions/`, - * - `projects//agent/environments//users//sessions/`, - * - `projects//locations//agent/environments//users//sessions/`, - * - * If `Location ID` is not specified we assume default 'us' location. If - * `Environment ID` is not specified, we assume default 'draft' environment. - * If `User ID` is not specified, we assume default '-' user. - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [Context]{@link google.cloud.dialogflow.v2beta1.Context}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listContextsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listContexts( - request?: protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, - protos.google.cloud.dialogflow.v2beta1.IListContextsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IContext>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, - protos.google.cloud.dialogflow.v2beta1.IListContextsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IContext>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IContext[], - protos.google.cloud.dialogflow.v2beta1.IListContextsRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListContextsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listContexts(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The session to list all contexts from. Supported formats: - * - `projects//agent/sessions/, - * - `projects//locations//agent/sessions/`, - * - `projects//agent/environments//users//sessions/`, - * - `projects//locations//agent/environments//users//sessions/`, - * - * If `Location ID` is not specified we assume default 'us' location. If - * `Environment ID` is not specified, we assume default 'draft' environment. - * If `User ID` is not specified, we assume default '-' user. - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Context]{@link google.cloud.dialogflow.v2beta1.Context} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listContextsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listContextsStream( - request?: protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listContexts.createStream( - this.innerApiCalls.listContexts as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listContexts`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The session to list all contexts from. Supported formats: - * - `projects//agent/sessions/, - * - `projects//locations//agent/sessions/`, - * - `projects//agent/environments//users//sessions/`, - * - `projects//locations//agent/environments//users//sessions/`, - * - * If `Location ID` is not specified we assume default 'us' location. If - * `Environment ID` is not specified, we assume default 'draft' environment. - * If `User ID` is not specified, we assume default '-' user. - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Context]{@link google.cloud.dialogflow.v2beta1.Context}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listContextsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listContextsAsync( - request?: protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listContexts.asyncIterate( - this.innerApiCalls['listContexts'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSession resource name string. - * - * @param {string} project - * @param {string} session - * @returns {string} Resource name string. - */ - projectAgentSessionPath(project:string,session:string) { - return this.pathTemplates.projectAgentSessionPathTemplate.render({ - project: project, - session: session, - }); - } - - /** - * Parse the project from ProjectAgentSession resource. - * - * @param {string} projectAgentSessionName - * A fully-qualified path representing project_agent_session resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionName(projectAgentSessionName: string) { - return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).project; - } - - /** - * Parse the session from ProjectAgentSession resource. - * - * @param {string} projectAgentSessionName - * A fully-qualified path representing project_agent_session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionName(projectAgentSessionName: string) { - return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).session; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.contextsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/contexts_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/contexts_client_config.json deleted file mode 100644 index d9e5c1a5..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/contexts_client_config.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2beta1.Contexts": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListContexts": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetContext": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateContext": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateContext": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteContext": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteAllContexts": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/contexts_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/contexts_proto_list.json deleted file mode 100644 index cb5136f1..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/contexts_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2beta1/context.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2beta1/document.proto", - "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", - "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2beta1/version.proto", - "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" -] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_client.ts deleted file mode 100644 index 0487c2db..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_client.ts +++ /dev/null @@ -1,2599 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2beta1/conversation_profiles_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './conversation_profiles_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2beta1.ConversationProfile|ConversationProfiles}. - * @class - * @memberof v2beta1 - */ -export class ConversationProfilesClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - conversationProfilesStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ConversationProfilesClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ConversationProfilesClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listConversationProfiles: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'conversationProfiles') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2beta1.ConversationProfiles', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.conversationProfilesStub) { - return this.conversationProfilesStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2beta1.ConversationProfiles. - this.conversationProfilesStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.ConversationProfiles') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2beta1.ConversationProfiles, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const conversationProfilesStubMethods = - ['listConversationProfiles', 'getConversationProfile', 'createConversationProfile', 'updateConversationProfile', 'deleteConversationProfile']; - for (const methodName of conversationProfilesStubMethods) { - const callPromise = this.conversationProfilesStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.conversationProfilesStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getConversationProfile( - request?: protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IConversationProfile, - protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest|undefined, {}|undefined - ]>; - getConversationProfile( - request: protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IConversationProfile, - protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest|null|undefined, - {}|null|undefined>): void; - getConversationProfile( - request: protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IConversationProfile, - protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specified conversation profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the conversation profile. - * Format: `projects//locations//conversationProfiles/`. - * @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. - * The first element of the array is an object representing [ConversationProfile]{@link google.cloud.dialogflow.v2beta1.ConversationProfile}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getConversationProfile(request); - */ - getConversationProfile( - request?: protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IConversationProfile, - protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IConversationProfile, - protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IConversationProfile, - protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getConversationProfile(request, options, callback); - } - createConversationProfile( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IConversationProfile, - protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest|undefined, {}|undefined - ]>; - createConversationProfile( - request: protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IConversationProfile, - protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest|null|undefined, - {}|null|undefined>): void; - createConversationProfile( - request: protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IConversationProfile, - protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates a conversation profile in the specified project. - * - * {@link |ConversationProfile.CreateTime} and {@link |ConversationProfile.UpdateTime} - * aren't populated in the response. You can retrieve them via - * {@link google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile|GetConversationProfile} API. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to create a conversation profile for. - * Format: `projects//locations/`. - * @param {google.cloud.dialogflow.v2beta1.ConversationProfile} request.conversationProfile - * Required. The conversation profile to create. - * @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. - * The first element of the array is an object representing [ConversationProfile]{@link google.cloud.dialogflow.v2beta1.ConversationProfile}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createConversationProfile(request); - */ - createConversationProfile( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IConversationProfile, - protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IConversationProfile, - protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IConversationProfile, - protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createConversationProfile(request, options, callback); - } - updateConversationProfile( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IConversationProfile, - protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest|undefined, {}|undefined - ]>; - updateConversationProfile( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IConversationProfile, - protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest|null|undefined, - {}|null|undefined>): void; - updateConversationProfile( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IConversationProfile, - protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified conversation profile. - * - * {@link |ConversationProfile.CreateTime} and {@link |ConversationProfile.UpdateTime} - * aren't populated in the response. You can retrieve them via - * {@link google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile|GetConversationProfile} API. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2beta1.ConversationProfile} request.conversationProfile - * Required. The conversation profile to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The mask to control which fields to update. - * @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. - * The first element of the array is an object representing [ConversationProfile]{@link google.cloud.dialogflow.v2beta1.ConversationProfile}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateConversationProfile(request); - */ - updateConversationProfile( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IConversationProfile, - protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IConversationProfile, - protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IConversationProfile, - protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'conversation_profile.name': request.conversationProfile!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateConversationProfile(request, options, callback); - } - deleteConversationProfile( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest|undefined, {}|undefined - ]>; - deleteConversationProfile( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest|null|undefined, - {}|null|undefined>): void; - deleteConversationProfile( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deletes the specified conversation profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the conversation profile to delete. - * Format: `projects//locations//conversationProfiles/`. - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteConversationProfile(request); - */ - deleteConversationProfile( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteConversationProfile(request, options, callback); - } - - listConversationProfiles( - request?: protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IConversationProfile[], - protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse - ]>; - listConversationProfiles( - request: protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, - protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IConversationProfile>): void; - listConversationProfiles( - request: protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, - protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IConversationProfile>): void; -/** - * Returns the list of all conversation profiles in the specified project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list all conversation profiles from. - * Format: `projects//locations/`. - * @param {number} request.pageSize - * The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [ConversationProfile]{@link google.cloud.dialogflow.v2beta1.ConversationProfile}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listConversationProfilesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listConversationProfiles( - request?: protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, - protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IConversationProfile>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, - protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IConversationProfile>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IConversationProfile[], - protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listConversationProfiles(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list all conversation profiles from. - * Format: `projects//locations/`. - * @param {number} request.pageSize - * The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [ConversationProfile]{@link google.cloud.dialogflow.v2beta1.ConversationProfile} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listConversationProfilesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listConversationProfilesStream( - request?: protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listConversationProfiles.createStream( - this.innerApiCalls.listConversationProfiles as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listConversationProfiles`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list all conversation profiles from. - * Format: `projects//locations/`. - * @param {number} request.pageSize - * The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [ConversationProfile]{@link google.cloud.dialogflow.v2beta1.ConversationProfile}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listConversationProfilesAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listConversationProfilesAsync( - request?: protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listConversationProfiles.asyncIterate( - this.innerApiCalls['listConversationProfiles'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.conversationProfilesStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_client_config.json deleted file mode 100644 index 1a172fb9..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_client_config.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2beta1.ConversationProfiles": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListConversationProfiles": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetConversationProfile": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateConversationProfile": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateConversationProfile": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteConversationProfile": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_proto_list.json deleted file mode 100644 index cb5136f1..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/conversation_profiles_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2beta1/context.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2beta1/document.proto", - "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", - "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2beta1/version.proto", - "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" -] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/conversations_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/conversations_client.ts deleted file mode 100644 index 36df034b..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/conversations_client.ts +++ /dev/null @@ -1,2896 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2beta1/conversations_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './conversations_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2beta1.Conversation|Conversations}. - * @class - * @memberof v2beta1 - */ -export class ConversationsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - conversationsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ConversationsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ConversationsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listConversations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'conversations'), - listMessages: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'messages') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2beta1.Conversations', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.conversationsStub) { - return this.conversationsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2beta1.Conversations. - this.conversationsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.Conversations') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2beta1.Conversations, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const conversationsStubMethods = - ['createConversation', 'listConversations', 'getConversation', 'completeConversation', 'batchCreateMessages', 'listMessages']; - for (const methodName of conversationsStubMethods) { - const callPromise = this.conversationsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.conversationsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - createConversation( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IConversation, - protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest|undefined, {}|undefined - ]>; - createConversation( - request: protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IConversation, - protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest|null|undefined, - {}|null|undefined>): void; - createConversation( - request: protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IConversation, - protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates a new conversation. Conversations are auto-completed after 24 - * hours. - * - * Conversation Lifecycle: - * There are two stages during a conversation: Automated Agent Stage and - * Assist Stage. - * - * For Automated Agent Stage, there will be a dialogflow agent responding to - * user queries. - * - * For Assist Stage, there's no dialogflow agent responding to user queries. - * But we will provide suggestions which are generated from conversation. - * - * If {@link google.cloud.dialogflow.v2beta1.Conversation.conversation_profile|Conversation.conversation_profile} is configured for a dialogflow - * agent, conversation will start from `Automated Agent Stage`, otherwise, it - * will start from `Assist Stage`. And during `Automated Agent Stage`, once an - * {@link google.cloud.dialogflow.v2beta1.Intent|Intent} with {@link google.cloud.dialogflow.v2beta1.Intent.live_agent_handoff|Intent.live_agent_handoff} is triggered, conversation - * will transfer to Assist Stage. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource identifier of the project creating the conversation. - * Format: `projects//locations/`. - * @param {google.cloud.dialogflow.v2beta1.Conversation} request.conversation - * Required. The conversation to create. - * @param {string} [request.conversationId] - * Optional. Identifier of the conversation. Generally it's auto generated by Google. - * Only set it if you cannot wait for the response to return a - * auto-generated one to you. - * - * The conversation ID must be compliant with the regression fomula - * "{@link a-zA-Z0-9_-|a-zA-Z}*" with the characters length in range of [3,64]. - * If the field is provided, the caller is resposible for - * 1. the uniqueness of the ID, otherwise the request will be rejected. - * 2. the consistency for whether to use custom ID or not under a project to - * better ensure uniqueness. - * @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. - * The first element of the array is an object representing [Conversation]{@link google.cloud.dialogflow.v2beta1.Conversation}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createConversation(request); - */ - createConversation( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IConversation, - protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IConversation, - protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IConversation, - protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createConversation(request, options, callback); - } - getConversation( - request?: protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IConversation, - protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest|undefined, {}|undefined - ]>; - getConversation( - request: protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IConversation, - protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest|null|undefined, - {}|null|undefined>): void; - getConversation( - request: protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IConversation, - protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specific conversation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the conversation. Format: - * `projects//locations//conversations/`. - * @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. - * The first element of the array is an object representing [Conversation]{@link google.cloud.dialogflow.v2beta1.Conversation}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getConversation(request); - */ - getConversation( - request?: protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IConversation, - protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IConversation, - protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IConversation, - protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getConversation(request, options, callback); - } - completeConversation( - request?: protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IConversation, - protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest|undefined, {}|undefined - ]>; - completeConversation( - request: protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IConversation, - protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest|null|undefined, - {}|null|undefined>): void; - completeConversation( - request: protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IConversation, - protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest|null|undefined, - {}|null|undefined>): void; -/** - * Completes the specified conversation. Finished conversations are purged - * from the database after 30 days. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource identifier of the conversation to close. - * Format: `projects//locations//conversations/`. - * @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. - * The first element of the array is an object representing [Conversation]{@link google.cloud.dialogflow.v2beta1.Conversation}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.completeConversation(request); - */ - completeConversation( - request?: protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IConversation, - protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IConversation, - protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IConversation, - protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.completeConversation(request, options, callback); - } - batchCreateMessages( - request?: protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse, - protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest|undefined, {}|undefined - ]>; - batchCreateMessages( - request: protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse, - protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest|null|undefined, - {}|null|undefined>): void; - batchCreateMessages( - request: protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse, - protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest|null|undefined, - {}|null|undefined>): void; -/** - * Batch ingests messages to conversation. Customers can use this RPC to - * ingest historical messages to conversation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource identifier of the conversation to create message. - * Format: `projects//locations//conversations/`. - * @param {number[]} request.requests - * Required. A maximum of 1000 Messages can be created in a batch. - * {@link |CreateMessageRequest.message.send_time} is required. All created - * messages will have identical {@link google.cloud.dialogflow.v2beta1.Message.create_time|Message.create_time}. - * @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. - * The first element of the array is an object representing [BatchCreateMessagesResponse]{@link google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.batchCreateMessages(request); - */ - batchCreateMessages( - request?: protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse, - protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse, - protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse, - protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.batchCreateMessages(request, options, callback); - } - - listConversations( - request?: protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IConversation[], - protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListConversationsResponse - ]>; - listConversations( - request: protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, - protos.google.cloud.dialogflow.v2beta1.IListConversationsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IConversation>): void; - listConversations( - request: protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, - protos.google.cloud.dialogflow.v2beta1.IListConversationsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IConversation>): void; -/** - * Returns the list of all conversations in the specified project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project from which to list all conversation. - * Format: `projects//locations/`. - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @param {string} request.filter - * A filter expression that filters conversations listed in the response. In - * general, the expression must specify the field name, a comparison operator, - * and the value to use for filtering: - *
    - *
  • The value must be a string, a number, or a boolean.
  • - *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • - *
  • To filter on multiple expressions, separate the - * expressions with `AND` or `OR` (omitting both implies `AND`).
  • - *
  • For clarity, expressions can be enclosed in parentheses.
  • - *
- * Only `lifecycle_state` can be filtered on in this way. For example, - * the following expression only returns `COMPLETED` conversations: - * - * `lifecycle_state = "COMPLETED"` - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @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. - * The first element of the array is Array of [Conversation]{@link google.cloud.dialogflow.v2beta1.Conversation}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listConversationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listConversations( - request?: protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, - protos.google.cloud.dialogflow.v2beta1.IListConversationsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IConversation>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, - protos.google.cloud.dialogflow.v2beta1.IListConversationsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IConversation>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IConversation[], - protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListConversationsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listConversations(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project from which to list all conversation. - * Format: `projects//locations/`. - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @param {string} request.filter - * A filter expression that filters conversations listed in the response. In - * general, the expression must specify the field name, a comparison operator, - * and the value to use for filtering: - *
    - *
  • The value must be a string, a number, or a boolean.
  • - *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • - *
  • To filter on multiple expressions, separate the - * expressions with `AND` or `OR` (omitting both implies `AND`).
  • - *
  • For clarity, expressions can be enclosed in parentheses.
  • - *
- * Only `lifecycle_state` can be filtered on in this way. For example, - * the following expression only returns `COMPLETED` conversations: - * - * `lifecycle_state = "COMPLETED"` - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Conversation]{@link google.cloud.dialogflow.v2beta1.Conversation} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listConversationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listConversationsStream( - request?: protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listConversations.createStream( - this.innerApiCalls.listConversations as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listConversations`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project from which to list all conversation. - * Format: `projects//locations/`. - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @param {string} request.filter - * A filter expression that filters conversations listed in the response. In - * general, the expression must specify the field name, a comparison operator, - * and the value to use for filtering: - *
    - *
  • The value must be a string, a number, or a boolean.
  • - *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • - *
  • To filter on multiple expressions, separate the - * expressions with `AND` or `OR` (omitting both implies `AND`).
  • - *
  • For clarity, expressions can be enclosed in parentheses.
  • - *
- * Only `lifecycle_state` can be filtered on in this way. For example, - * the following expression only returns `COMPLETED` conversations: - * - * `lifecycle_state = "COMPLETED"` - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Conversation]{@link google.cloud.dialogflow.v2beta1.Conversation}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listConversationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listConversationsAsync( - request?: protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listConversations.asyncIterate( - this.innerApiCalls['listConversations'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - listMessages( - request?: protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IMessage[], - protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListMessagesResponse - ]>; - listMessages( - request: protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, - protos.google.cloud.dialogflow.v2beta1.IListMessagesResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IMessage>): void; - listMessages( - request: protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, - protos.google.cloud.dialogflow.v2beta1.IListMessagesResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IMessage>): void; -/** - * Lists messages that belong to a given conversation. - * `messages` are ordered by `create_time` in descending order. To fetch - * updates without duplication, send request with filter - * `create_time_epoch_microseconds > - * [first item's create_time of previous request]` and empty page_token. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the conversation to list messages for. - * Format: `projects//locations//conversations/` - * @param {string} request.filter - * Optional. Filter on message fields. Currently predicates on `create_time` - * and `create_time_epoch_microseconds` are supported. `create_time` only - * support milliseconds accuracy. E.g., - * `create_time_epoch_microseconds > 1551790877964485` or - * `create_time > "2017-01-15T01:30:15.01Z"`. - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [Message]{@link google.cloud.dialogflow.v2beta1.Message}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listMessagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listMessages( - request?: protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, - protos.google.cloud.dialogflow.v2beta1.IListMessagesResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IMessage>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, - protos.google.cloud.dialogflow.v2beta1.IListMessagesResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IMessage>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IMessage[], - protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListMessagesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listMessages(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the conversation to list messages for. - * Format: `projects//locations//conversations/` - * @param {string} request.filter - * Optional. Filter on message fields. Currently predicates on `create_time` - * and `create_time_epoch_microseconds` are supported. `create_time` only - * support milliseconds accuracy. E.g., - * `create_time_epoch_microseconds > 1551790877964485` or - * `create_time > "2017-01-15T01:30:15.01Z"`. - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Message]{@link google.cloud.dialogflow.v2beta1.Message} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listMessagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listMessagesStream( - request?: protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listMessages.createStream( - this.innerApiCalls.listMessages as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMessages`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the conversation to list messages for. - * Format: `projects//locations//conversations/` - * @param {string} request.filter - * Optional. Filter on message fields. Currently predicates on `create_time` - * and `create_time_epoch_microseconds` are supported. `create_time` only - * support milliseconds accuracy. E.g., - * `create_time_epoch_microseconds > 1551790877964485` or - * `create_time > "2017-01-15T01:30:15.01Z"`. - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Message]{@link google.cloud.dialogflow.v2beta1.Message}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listMessagesAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listMessagesAsync( - request?: protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listMessages.asyncIterate( - this.innerApiCalls['listMessages'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.conversationsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/conversations_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/conversations_client_config.json deleted file mode 100644 index 2e1a335b..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/conversations_client_config.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2beta1.Conversations": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateConversation": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ListConversations": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetConversation": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CompleteConversation": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "BatchCreateMessages": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ListMessages": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/conversations_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/conversations_proto_list.json deleted file mode 100644 index cb5136f1..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/conversations_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2beta1/context.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2beta1/document.proto", - "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", - "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2beta1/version.proto", - "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" -] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/documents_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/documents_client.ts deleted file mode 100644 index 370e0d94..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/documents_client.ts +++ /dev/null @@ -1,3032 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2beta1/documents_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './documents_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * Service for managing knowledge {@link google.cloud.dialogflow.v2beta1.Document|Documents}. - * @class - * @memberof v2beta1 - */ -export class DocumentsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - documentsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DocumentsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DocumentsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listDocuments: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'documents') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - - this.operationsClient = this._gaxModule.lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }).operationsClient(opts); - const createDocumentResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2beta1.Document') as gax.protobuf.Type; - const createDocumentMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata') as gax.protobuf.Type; - const importDocumentsResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2beta1.ImportDocumentsResponse') as gax.protobuf.Type; - const importDocumentsMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata') as gax.protobuf.Type; - const deleteDocumentResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteDocumentMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata') as gax.protobuf.Type; - const updateDocumentResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2beta1.Document') as gax.protobuf.Type; - const updateDocumentMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata') as gax.protobuf.Type; - const reloadDocumentResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2beta1.Document') as gax.protobuf.Type; - const reloadDocumentMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createDocument: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createDocumentResponse.decode.bind(createDocumentResponse), - createDocumentMetadata.decode.bind(createDocumentMetadata)), - importDocuments: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - importDocumentsResponse.decode.bind(importDocumentsResponse), - importDocumentsMetadata.decode.bind(importDocumentsMetadata)), - deleteDocument: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteDocumentResponse.decode.bind(deleteDocumentResponse), - deleteDocumentMetadata.decode.bind(deleteDocumentMetadata)), - updateDocument: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateDocumentResponse.decode.bind(updateDocumentResponse), - updateDocumentMetadata.decode.bind(updateDocumentMetadata)), - reloadDocument: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - reloadDocumentResponse.decode.bind(reloadDocumentResponse), - reloadDocumentMetadata.decode.bind(reloadDocumentMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2beta1.Documents', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.documentsStub) { - return this.documentsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2beta1.Documents. - this.documentsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.Documents') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2beta1.Documents, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const documentsStubMethods = - ['listDocuments', 'getDocument', 'createDocument', 'importDocuments', 'deleteDocument', 'updateDocument', 'reloadDocument']; - for (const methodName of documentsStubMethods) { - const callPromise = this.documentsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.documentsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getDocument( - request?: protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IDocument, - protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest|undefined, {}|undefined - ]>; - getDocument( - request: protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IDocument, - protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest|null|undefined, - {}|null|undefined>): void; - getDocument( - request: protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IDocument, - protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specified document. - * - * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; - * only use `projects.knowledgeBases.documents`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the document to retrieve. - * 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. - * The first element of the array is an object representing [Document]{@link google.cloud.dialogflow.v2beta1.Document}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getDocument(request); - */ - getDocument( - request?: protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IDocument, - protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IDocument, - protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IDocument, - protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getDocument(request, options, callback); - } - - createDocument( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateDocumentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createDocument( - request: protos.google.cloud.dialogflow.v2beta1.ICreateDocumentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createDocument( - request: protos.google.cloud.dialogflow.v2beta1.ICreateDocumentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Creates a new document. - * - * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; - * only use `projects.knowledgeBases.documents`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The knowledge base to create a document for. - * 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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.createDocument(request); - * const [response] = await operation.promise(); - */ - createDocument( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateDocumentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createDocument(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createDocument()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkCreateDocumentProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkCreateDocumentProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createDocument, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - importDocuments( - request?: protos.google.cloud.dialogflow.v2beta1.IImportDocumentsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - importDocuments( - request: protos.google.cloud.dialogflow.v2beta1.IImportDocumentsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importDocuments( - request: protos.google.cloud.dialogflow.v2beta1.IImportDocumentsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Create documents by importing data from external sources. - * Dialogflow supports up to 350 documents in each request. If you try to - * import more, Dialogflow will return an error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The knowledge base to import documents into. - * Format: `projects//locations//knowledgeBases/`. - * @param {google.cloud.dialogflow.v2beta1.GcsSources} request.gcsSource - * The Google Cloud Storage location for the documents. - * The path can include a wildcard. - * - * These URIs may have the forms - * `gs:///`. - * `gs:////*.`. - * @param {google.cloud.dialogflow.v2beta1.ImportDocumentTemplate} request.documentTemplate - * Required. Document template used for importing all the documents. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.importDocuments(request); - * const [response] = await operation.promise(); - */ - importDocuments( - request?: protos.google.cloud.dialogflow.v2beta1.IImportDocumentsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.importDocuments(request, options, callback); - } -/** - * Check the status of the long running operation returned by `importDocuments()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkImportDocumentsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkImportDocumentsProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.importDocuments, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - deleteDocument( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteDocument( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteDocument( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Deletes the specified document. - * - * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; - * only use `projects.knowledgeBases.documents`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the document to delete. - * 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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.deleteDocument(request); - * const [response] = await operation.promise(); - */ - deleteDocument( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteDocument(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteDocument()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkDeleteDocumentProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkDeleteDocumentProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteDocument, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - updateDocument( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateDocument( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateDocument( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified document. - * - * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; - * only use `projects.knowledgeBases.documents`. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2beta1.Document} request.document - * Required. The document to update. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Not specified means `update all`. - * Currently, only `display_name` can be updated, an InvalidArgument will be - * returned for attempting to update other fields. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.updateDocument(request); - * const [response] = await operation.promise(); - */ - updateDocument( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'document.name': request.document!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateDocument(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateDocument()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkUpdateDocumentProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkUpdateDocumentProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateDocument, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - reloadDocument( - request?: protos.google.cloud.dialogflow.v2beta1.IReloadDocumentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - reloadDocument( - request: protos.google.cloud.dialogflow.v2beta1.IReloadDocumentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - reloadDocument( - request: protos.google.cloud.dialogflow.v2beta1.IReloadDocumentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Reloads the specified document from its specified source, content_uri or - * content. The previously loaded content of the document will be deleted. - * Note: Even when the content of the document has not changed, there still - * may be side effects because of internal implementation changes. - * Note: If the document source is Google Cloud Storage URI, its metadata will - * be replaced with the custom metadata from Google Cloud Storage if the - * `import_gcs_custom_metadata` field is set to true in the request. - * - * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; - * only use `projects.knowledgeBases.documents`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the document to reload. - * 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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.reloadDocument(request); - * const [response] = await operation.promise(); - */ - reloadDocument( - request?: protos.google.cloud.dialogflow.v2beta1.IReloadDocumentRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.reloadDocument(request, options, callback); - } -/** - * Check the status of the long running operation returned by `reloadDocument()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkReloadDocumentProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkReloadDocumentProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.reloadDocument, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - listDocuments( - request?: protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IDocument[], - protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListDocumentsResponse - ]>; - listDocuments( - request: protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, - protos.google.cloud.dialogflow.v2beta1.IListDocumentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IDocument>): void; - listDocuments( - request: protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, - protos.google.cloud.dialogflow.v2beta1.IListDocumentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IDocument>): void; -/** - * Returns the list of all documents of the knowledge base. - * - * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; - * only use `projects.knowledgeBases.documents`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The knowledge base to list all documents for. - * 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. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @param {string} request.filter - * The filter expression used to filter documents returned by the list method. - * The expression has the following syntax: - * - * [AND ] ... - * - * The following fields and operators are supported: - * - * * knowledge_types with has(:) operator - * * display_name with has(:) operator - * * state with equals(=) operator - * - * Examples: - * - * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. - * * "display_name:customer" matches documents whose display name contains - * "customer". - * * "state=ACTIVE" matches documents with ACTIVE state. - * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @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. - * The first element of the array is Array of [Document]{@link google.cloud.dialogflow.v2beta1.Document}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listDocumentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listDocuments( - request?: protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, - protos.google.cloud.dialogflow.v2beta1.IListDocumentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IDocument>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, - protos.google.cloud.dialogflow.v2beta1.IListDocumentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IDocument>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IDocument[], - protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListDocumentsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listDocuments(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The knowledge base to list all documents for. - * 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. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @param {string} request.filter - * The filter expression used to filter documents returned by the list method. - * The expression has the following syntax: - * - * [AND ] ... - * - * The following fields and operators are supported: - * - * * knowledge_types with has(:) operator - * * display_name with has(:) operator - * * state with equals(=) operator - * - * Examples: - * - * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. - * * "display_name:customer" matches documents whose display name contains - * "customer". - * * "state=ACTIVE" matches documents with ACTIVE state. - * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Document]{@link google.cloud.dialogflow.v2beta1.Document} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listDocumentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listDocumentsStream( - request?: protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listDocuments.createStream( - this.innerApiCalls.listDocuments as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDocuments`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The knowledge base to list all documents for. - * 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. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @param {string} request.filter - * The filter expression used to filter documents returned by the list method. - * The expression has the following syntax: - * - * [AND ] ... - * - * The following fields and operators are supported: - * - * * knowledge_types with has(:) operator - * * display_name with has(:) operator - * * state with equals(=) operator - * - * Examples: - * - * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. - * * "display_name:customer" matches documents whose display name contains - * "customer". - * * "state=ACTIVE" matches documents with ACTIVE state. - * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Document]{@link google.cloud.dialogflow.v2beta1.Document}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listDocumentsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listDocumentsAsync( - request?: protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listDocuments.asyncIterate( - this.innerApiCalls['listDocuments'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.documentsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/documents_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/documents_client_config.json deleted file mode 100644 index 99466943..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/documents_client_config.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2beta1.Documents": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListDocuments": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetDocument": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateDocument": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ImportDocuments": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteDocument": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateDocument": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ReloadDocument": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/documents_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/documents_proto_list.json deleted file mode 100644 index cb5136f1..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/documents_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2beta1/context.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2beta1/document.proto", - "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", - "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2beta1/version.proto", - "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" -] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/entity_types_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/entity_types_client.ts deleted file mode 100644 index 6a070e2f..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/entity_types_client.ts +++ /dev/null @@ -1,3244 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2beta1/entity_types_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './entity_types_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2beta1.EntityType|EntityTypes}. - * @class - * @memberof v2beta1 - */ -export class EntityTypesClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - entityTypesStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of EntityTypesClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof EntityTypesClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listEntityTypes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'entityTypes') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - - this.operationsClient = this._gaxModule.lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }).operationsClient(opts); - const batchUpdateEntityTypesResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse') as gax.protobuf.Type; - const batchUpdateEntityTypesMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - const batchDeleteEntityTypesResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const batchDeleteEntityTypesMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - const batchCreateEntitiesResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const batchCreateEntitiesMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - const batchUpdateEntitiesResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const batchUpdateEntitiesMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - const batchDeleteEntitiesResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const batchDeleteEntitiesMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - - this.descriptors.longrunning = { - batchUpdateEntityTypes: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - batchUpdateEntityTypesResponse.decode.bind(batchUpdateEntityTypesResponse), - batchUpdateEntityTypesMetadata.decode.bind(batchUpdateEntityTypesMetadata)), - batchDeleteEntityTypes: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - batchDeleteEntityTypesResponse.decode.bind(batchDeleteEntityTypesResponse), - batchDeleteEntityTypesMetadata.decode.bind(batchDeleteEntityTypesMetadata)), - batchCreateEntities: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - batchCreateEntitiesResponse.decode.bind(batchCreateEntitiesResponse), - batchCreateEntitiesMetadata.decode.bind(batchCreateEntitiesMetadata)), - batchUpdateEntities: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - batchUpdateEntitiesResponse.decode.bind(batchUpdateEntitiesResponse), - batchUpdateEntitiesMetadata.decode.bind(batchUpdateEntitiesMetadata)), - batchDeleteEntities: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - batchDeleteEntitiesResponse.decode.bind(batchDeleteEntitiesResponse), - batchDeleteEntitiesMetadata.decode.bind(batchDeleteEntitiesMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2beta1.EntityTypes', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.entityTypesStub) { - return this.entityTypesStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2beta1.EntityTypes. - this.entityTypesStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.EntityTypes') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2beta1.EntityTypes, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const entityTypesStubMethods = - ['listEntityTypes', 'getEntityType', 'createEntityType', 'updateEntityType', 'deleteEntityType', 'batchUpdateEntityTypes', 'batchDeleteEntityTypes', 'batchCreateEntities', 'batchUpdateEntities', 'batchDeleteEntities']; - for (const methodName of entityTypesStubMethods) { - const callPromise = this.entityTypesStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.entityTypesStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getEntityType( - request?: protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IEntityType, - protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest|undefined, {}|undefined - ]>; - getEntityType( - request: protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IEntityType, - protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest|null|undefined, - {}|null|undefined>): void; - getEntityType( - request: protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IEntityType, - protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specified entity type. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the entity type. - * Supported formats: - * - `projects//agent/entityTypes/` - * - `projects//locations//agent/entityTypes/` - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @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. - * The first element of the array is an object representing [EntityType]{@link google.cloud.dialogflow.v2beta1.EntityType}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getEntityType(request); - */ - getEntityType( - request?: protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IEntityType, - protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IEntityType, - protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IEntityType, - protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getEntityType(request, options, callback); - } - createEntityType( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IEntityType, - protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest|undefined, {}|undefined - ]>; - createEntityType( - request: protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IEntityType, - protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest|null|undefined, - {}|null|undefined>): void; - createEntityType( - request: protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IEntityType, - protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates an entity type in the specified agent. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to create a entity type for. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - * @param {google.cloud.dialogflow.v2beta1.EntityType} request.entityType - * Required. The entity type to create. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @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. - * The first element of the array is an object representing [EntityType]{@link google.cloud.dialogflow.v2beta1.EntityType}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createEntityType(request); - */ - createEntityType( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IEntityType, - protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IEntityType, - protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IEntityType, - protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createEntityType(request, options, callback); - } - updateEntityType( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IEntityType, - protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest|undefined, {}|undefined - ]>; - updateEntityType( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IEntityType, - protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest|null|undefined, - {}|null|undefined>): void; - updateEntityType( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IEntityType, - protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified entity type. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2beta1.EntityType} request.entityType - * Required. The entity type to update. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The mask to control which fields get updated. - * @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. - * The first element of the array is an object representing [EntityType]{@link google.cloud.dialogflow.v2beta1.EntityType}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateEntityType(request); - */ - updateEntityType( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IEntityType, - protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IEntityType, - protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IEntityType, - protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'entity_type.name': request.entityType!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateEntityType(request, options, callback); - } - deleteEntityType( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest|undefined, {}|undefined - ]>; - deleteEntityType( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest|null|undefined, - {}|null|undefined>): void; - deleteEntityType( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deletes the specified entity type. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the entity type to delete. - * Supported formats: - * - `projects//agent/entityTypes/` - * - `projects//locations//agent/entityTypes/` - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteEntityType(request); - */ - deleteEntityType( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteEntityType(request, options, callback); - } - - batchUpdateEntityTypes( - request?: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - batchUpdateEntityTypes( - request: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchUpdateEntityTypes( - request: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Updates/Creates multiple entity types in the specified agent. - * Operation - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the agent to update or create entity types in. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - * @param {string} request.entityTypeBatchUri - * The URI to a Google Cloud Storage file containing entity types to update - * or create. The file format can either be a serialized proto (of - * EntityBatch type) or a JSON object. Note: The URI must start with - * "gs://". - * @param {google.cloud.dialogflow.v2beta1.EntityTypeBatch} request.entityTypeBatchInline - * The collection of entity types to update or create. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The mask to control which fields get updated. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.batchUpdateEntityTypes(request); - * const [response] = await operation.promise(); - */ - batchUpdateEntityTypes( - request?: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.batchUpdateEntityTypes(request, options, callback); - } -/** - * Check the status of the long running operation returned by `batchUpdateEntityTypes()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkBatchUpdateEntityTypesProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkBatchUpdateEntityTypesProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchUpdateEntityTypes, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - batchDeleteEntityTypes( - request?: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - batchDeleteEntityTypes( - request: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchDeleteEntityTypes( - request: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Deletes entity types in the specified agent. - * Operation - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the agent to delete all entities types for. - * Supported formats: - * - `projects//agent`, - * - `projects//locations//agent`. - * @param {string[]} request.entityTypeNames - * Required. The names entity types to delete. All names must point to the - * same agent as `parent`. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.batchDeleteEntityTypes(request); - * const [response] = await operation.promise(); - */ - batchDeleteEntityTypes( - request?: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.batchDeleteEntityTypes(request, options, callback); - } -/** - * Check the status of the long running operation returned by `batchDeleteEntityTypes()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkBatchDeleteEntityTypesProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkBatchDeleteEntityTypesProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchDeleteEntityTypes, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - batchCreateEntities( - request?: protos.google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - batchCreateEntities( - request: protos.google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchCreateEntities( - request: protos.google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Creates multiple new entities in the specified entity type. - * - * Operation - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the entity type to create entities in. - * Supported formats: - * - `projects//agent/entityTypes/` - * - `projects//locations//agent/entityTypes/` - * @param {number[]} request.entities - * Required. The entities to create. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.batchCreateEntities(request); - * const [response] = await operation.promise(); - */ - batchCreateEntities( - request?: protos.google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.batchCreateEntities(request, options, callback); - } -/** - * Check the status of the long running operation returned by `batchCreateEntities()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkBatchCreateEntitiesProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkBatchCreateEntitiesProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchCreateEntities, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - batchUpdateEntities( - request?: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - batchUpdateEntities( - request: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchUpdateEntities( - request: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Updates or creates multiple entities in the specified entity type. This - * method does not affect entities in the entity type that aren't explicitly - * specified in the request. - * - * Operation - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the entity type to update or create entities in. - * Supported formats: - * - `projects//agent/entityTypes/` - * - `projects//locations//agent/entityTypes/` - * @param {number[]} request.entities - * Required. The entities to update or create. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {google.protobuf.FieldMask} request.updateMask - * Optional. The mask to control which fields get updated. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.batchUpdateEntities(request); - * const [response] = await operation.promise(); - */ - batchUpdateEntities( - request?: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.batchUpdateEntities(request, options, callback); - } -/** - * Check the status of the long running operation returned by `batchUpdateEntities()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkBatchUpdateEntitiesProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkBatchUpdateEntitiesProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchUpdateEntities, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - batchDeleteEntities( - request?: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - batchDeleteEntities( - request: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchDeleteEntities( - request: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Deletes entities in the specified entity type. - * - * Operation - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the entity type to delete entries for. - * Supported formats: - * - `projects//agent/entityTypes/` - * - `projects//locations//agent/entityTypes/` - * @param {string[]} request.entityValues - * Required. The reference `values` of the entities to delete. Note that - * these are not fully-qualified names, i.e. they don't start with - * `projects/`. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.batchDeleteEntities(request); - * const [response] = await operation.promise(); - */ - batchDeleteEntities( - request?: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.batchDeleteEntities(request, options, callback); - } -/** - * Check the status of the long running operation returned by `batchDeleteEntities()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkBatchDeleteEntitiesProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkBatchDeleteEntitiesProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchDeleteEntities, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - listEntityTypes( - request?: protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IEntityType[], - protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListEntityTypesResponse - ]>; - listEntityTypes( - request: protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, - protos.google.cloud.dialogflow.v2beta1.IListEntityTypesResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IEntityType>): void; - listEntityTypes( - request: protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, - protos.google.cloud.dialogflow.v2beta1.IListEntityTypesResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IEntityType>): void; -/** - * Returns the list of all entity types in the specified agent. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all entity types from. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [EntityType]{@link google.cloud.dialogflow.v2beta1.EntityType}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listEntityTypesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listEntityTypes( - request?: protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, - protos.google.cloud.dialogflow.v2beta1.IListEntityTypesResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IEntityType>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, - protos.google.cloud.dialogflow.v2beta1.IListEntityTypesResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IEntityType>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IEntityType[], - protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListEntityTypesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listEntityTypes(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all entity types from. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [EntityType]{@link google.cloud.dialogflow.v2beta1.EntityType} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listEntityTypesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listEntityTypesStream( - request?: protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listEntityTypes.createStream( - this.innerApiCalls.listEntityTypes as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listEntityTypes`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all entity types from. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [EntityType]{@link google.cloud.dialogflow.v2beta1.EntityType}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listEntityTypesAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listEntityTypesAsync( - request?: protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listEntityTypes.asyncIterate( - this.innerApiCalls['listEntityTypes'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.entityTypesStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/entity_types_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/entity_types_client_config.json deleted file mode 100644 index 987e4260..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/entity_types_client_config.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2beta1.EntityTypes": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListEntityTypes": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "BatchUpdateEntityTypes": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "BatchDeleteEntityTypes": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "BatchCreateEntities": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "BatchUpdateEntities": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "BatchDeleteEntities": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/entity_types_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/entity_types_proto_list.json deleted file mode 100644 index cb5136f1..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/entity_types_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2beta1/context.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2beta1/document.proto", - "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", - "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2beta1/version.proto", - "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" -] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/environments_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/environments_client.ts deleted file mode 100644 index deef1e8e..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/environments_client.ts +++ /dev/null @@ -1,2813 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2beta1/environments_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './environments_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2beta1.Environment|Environments}. - * @class - * @memberof v2beta1 - */ -export class EnvironmentsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - environmentsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of EnvironmentsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof EnvironmentsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listEnvironments: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'environments'), - getEnvironmentHistory: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'entries') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2beta1.Environments', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.environmentsStub) { - return this.environmentsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2beta1.Environments. - this.environmentsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.Environments') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2beta1.Environments, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const environmentsStubMethods = - ['listEnvironments', 'getEnvironment', 'createEnvironment', 'updateEnvironment', 'deleteEnvironment', 'getEnvironmentHistory']; - for (const methodName of environmentsStubMethods) { - const callPromise = this.environmentsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.environmentsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getEnvironment( - request?: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IEnvironment, - protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest|undefined, {}|undefined - ]>; - getEnvironment( - request: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IEnvironment, - protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest|null|undefined, - {}|null|undefined>): void; - getEnvironment( - request: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IEnvironment, - protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specified agent environment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the environment. - * Supported formats: - * - `projects//agent/environments/` - * - `projects//locations//agent/environments/` - * @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. - * The first element of the array is an object representing [Environment]{@link google.cloud.dialogflow.v2beta1.Environment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getEnvironment(request); - */ - getEnvironment( - request?: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IEnvironment, - protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IEnvironment, - protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IEnvironment, - protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getEnvironment(request, options, callback); - } - createEnvironment( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IEnvironment, - protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest|undefined, {}|undefined - ]>; - createEnvironment( - request: protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IEnvironment, - protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest|null|undefined, - {}|null|undefined>): void; - createEnvironment( - request: protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IEnvironment, - protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates an agent environment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to create an environment for. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - * @param {google.cloud.dialogflow.v2beta1.Environment} request.environment - * Required. The environment to create. - * @param {string} request.environmentId - * Required. The unique id of the new environment. - * @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. - * The first element of the array is an object representing [Environment]{@link google.cloud.dialogflow.v2beta1.Environment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createEnvironment(request); - */ - createEnvironment( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IEnvironment, - protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IEnvironment, - protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IEnvironment, - protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createEnvironment(request, options, callback); - } - updateEnvironment( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IEnvironment, - protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest|undefined, {}|undefined - ]>; - updateEnvironment( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IEnvironment, - protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest|null|undefined, - {}|null|undefined>): void; - updateEnvironment( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IEnvironment, - protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified agent environment. - * - * This method allows you to deploy new agent versions into the environment. - * When an environment is pointed to a new agent version by setting - * `environment.agent_version`, the environment is temporarily set to the - * `LOADING` state. During that time, the environment keeps on serving the - * previous version of the agent. After the new agent version is done loading, - * the environment is set back to the `RUNNING` state. - * You can use "-" as Environment ID in environment name to update version - * in "draft" environment. WARNING: this will negate all recent changes to - * draft and can't be undone. You may want to save the draft to a version - * before calling this function. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2beta1.Environment} request.environment - * Required. The environment to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The mask to control which fields get updated. - * @param {boolean} [request.allowLoadToDraftAndDiscardChanges] - * Optional. This field is used to prevent accidental overwrite of the draft - * environment, which is an operation that cannot be undone. To confirm that - * the caller desires this overwrite, this field must be explicitly set to - * true when updating the draft environment (environment ID = `-`). - * @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. - * The first element of the array is an object representing [Environment]{@link google.cloud.dialogflow.v2beta1.Environment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateEnvironment(request); - */ - updateEnvironment( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IEnvironment, - protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IEnvironment, - protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IEnvironment, - protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'environment.name': request.environment!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateEnvironment(request, options, callback); - } - deleteEnvironment( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest|undefined, {}|undefined - ]>; - deleteEnvironment( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest|null|undefined, - {}|null|undefined>): void; - deleteEnvironment( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deletes the specified agent environment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the environment to delete. - * / Format: - * - `projects//agent/environments/` - * - `projects//locations//agent/environments/` - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteEnvironment(request); - */ - deleteEnvironment( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteEnvironment(request, options, callback); - } - - listEnvironments( - request?: protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IEnvironment[], - protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse - ]>; - listEnvironments( - request: protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, - protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IEnvironment>): void; - listEnvironments( - request: protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, - protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IEnvironment>): void; -/** - * Returns the list of all non-draft environments of the specified agent. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all environments from. - * Format: - * - `projects//agent` - * - `projects//locations//agent` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [Environment]{@link google.cloud.dialogflow.v2beta1.Environment}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listEnvironmentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listEnvironments( - request?: protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, - protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IEnvironment>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, - protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IEnvironment>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IEnvironment[], - protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listEnvironments(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all environments from. - * Format: - * - `projects//agent` - * - `projects//locations//agent` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Environment]{@link google.cloud.dialogflow.v2beta1.Environment} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listEnvironmentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listEnvironmentsStream( - request?: protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listEnvironments.createStream( - this.innerApiCalls.listEnvironments as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listEnvironments`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all environments from. - * Format: - * - `projects//agent` - * - `projects//locations//agent` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Environment]{@link google.cloud.dialogflow.v2beta1.Environment}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listEnvironmentsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listEnvironmentsAsync( - request?: protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listEnvironments.asyncIterate( - this.innerApiCalls['listEnvironments'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - getEnvironmentHistory( - request?: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry[], - protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest|null, - protos.google.cloud.dialogflow.v2beta1.IEnvironmentHistory - ]>; - getEnvironmentHistory( - request: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, - protos.google.cloud.dialogflow.v2beta1.IEnvironmentHistory|null|undefined, - protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry>): void; - getEnvironmentHistory( - request: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, - protos.google.cloud.dialogflow.v2beta1.IEnvironmentHistory|null|undefined, - protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry>): void; -/** - * Gets the history of the specified environment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the environment to retrieve history for. - * Supported formats: - * - `projects//agent/environments/` - * - `projects//locations//agent/environments/` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [Entry]{@link google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `getEnvironmentHistoryAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - getEnvironmentHistory( - request?: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, - protos.google.cloud.dialogflow.v2beta1.IEnvironmentHistory|null|undefined, - protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, - protos.google.cloud.dialogflow.v2beta1.IEnvironmentHistory|null|undefined, - protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry[], - protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest|null, - protos.google.cloud.dialogflow.v2beta1.IEnvironmentHistory - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.getEnvironmentHistory(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the environment to retrieve history for. - * Supported formats: - * - `projects//agent/environments/` - * - `projects//locations//agent/environments/` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Entry]{@link google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `getEnvironmentHistoryAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - getEnvironmentHistoryStream( - request?: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.getEnvironmentHistory.createStream( - this.innerApiCalls.getEnvironmentHistory as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `getEnvironmentHistory`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the environment to retrieve history for. - * Supported formats: - * - `projects//agent/environments/` - * - `projects//locations//agent/environments/` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Entry]{@link google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.getEnvironmentHistoryAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - getEnvironmentHistoryAsync( - request?: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.getEnvironmentHistory.asyncIterate( - this.innerApiCalls['getEnvironmentHistory'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.environmentsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/environments_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/environments_client_config.json deleted file mode 100644 index 4fd9caa5..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/environments_client_config.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2beta1.Environments": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListEnvironments": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetEnvironment": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateEnvironment": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateEnvironment": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteEnvironment": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetEnvironmentHistory": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/environments_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/environments_proto_list.json deleted file mode 100644 index cb5136f1..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/environments_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2beta1/context.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2beta1/document.proto", - "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", - "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2beta1/version.proto", - "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" -] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/fulfillments_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/fulfillments_client.ts deleted file mode 100644 index 66a88957..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/fulfillments_client.ts +++ /dev/null @@ -1,2228 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2beta1/fulfillments_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './fulfillments_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2beta1.Fulfillment|Fulfillments}. - * @class - * @memberof v2beta1 - */ -export class FulfillmentsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - fulfillmentsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of FulfillmentsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof FulfillmentsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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}' - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2beta1.Fulfillments', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.fulfillmentsStub) { - return this.fulfillmentsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2beta1.Fulfillments. - this.fulfillmentsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.Fulfillments') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2beta1.Fulfillments, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const fulfillmentsStubMethods = - ['getFulfillment', 'updateFulfillment']; - for (const methodName of fulfillmentsStubMethods) { - const callPromise = this.fulfillmentsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.fulfillmentsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getFulfillment( - request?: protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IFulfillment, - protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest|undefined, {}|undefined - ]>; - getFulfillment( - request: protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IFulfillment, - protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest|null|undefined, - {}|null|undefined>): void; - getFulfillment( - request: protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IFulfillment, - protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the fulfillment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the fulfillment. - * Supported formats: - * - `projects//agent/fulfillment` - * - `projects//locations//agent/fulfillment` - * @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. - * The first element of the array is an object representing [Fulfillment]{@link google.cloud.dialogflow.v2beta1.Fulfillment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getFulfillment(request); - */ - getFulfillment( - request?: protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IFulfillment, - protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IFulfillment, - protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IFulfillment, - protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getFulfillment(request, options, callback); - } - updateFulfillment( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IFulfillment, - protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest|undefined, {}|undefined - ]>; - updateFulfillment( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IFulfillment, - protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest|null|undefined, - {}|null|undefined>): void; - updateFulfillment( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IFulfillment, - protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the fulfillment. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2beta1.Fulfillment} request.fulfillment - * Required. The fulfillment to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The mask to control which fields get updated. If the mask is not - * present, all fields will be updated. - * @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. - * The first element of the array is an object representing [Fulfillment]{@link google.cloud.dialogflow.v2beta1.Fulfillment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateFulfillment(request); - */ - updateFulfillment( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IFulfillment, - protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IFulfillment, - protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IFulfillment, - protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'fulfillment.name': request.fulfillment!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateFulfillment(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.fulfillmentsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/fulfillments_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/fulfillments_client_config.json deleted file mode 100644 index b865673e..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/fulfillments_client_config.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2beta1.Fulfillments": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetFulfillment": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateFulfillment": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/fulfillments_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/fulfillments_proto_list.json deleted file mode 100644 index cb5136f1..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/fulfillments_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2beta1/context.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2beta1/document.proto", - "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", - "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2beta1/version.proto", - "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" -] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/gapic_metadata.json b/owl-bot-staging/v2beta1/src/v2beta1/gapic_metadata.json deleted file mode 100644 index 29a7df99..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/gapic_metadata.json +++ /dev/null @@ -1,1158 +0,0 @@ -{ - "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" - ] - } - } - } - } - }, - "AnswerRecords": { - "clients": { - "grpc": { - "libraryClient": "AnswerRecordsClient", - "rpcs": { - "GetAnswerRecord": { - "methods": [ - "getAnswerRecord" - ] - }, - "UpdateAnswerRecord": { - "methods": [ - "updateAnswerRecord" - ] - }, - "ListAnswerRecords": { - "methods": [ - "listAnswerRecords", - "listAnswerRecordsStream", - "listAnswerRecordsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "AnswerRecordsClient", - "rpcs": { - "GetAnswerRecord": { - "methods": [ - "getAnswerRecord" - ] - }, - "UpdateAnswerRecord": { - "methods": [ - "updateAnswerRecord" - ] - }, - "ListAnswerRecords": { - "methods": [ - "listAnswerRecords", - "listAnswerRecordsStream", - "listAnswerRecordsAsync" - ] - } - } - } - } - }, - "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" - ] - } - } - } - } - }, - "ConversationProfiles": { - "clients": { - "grpc": { - "libraryClient": "ConversationProfilesClient", - "rpcs": { - "GetConversationProfile": { - "methods": [ - "getConversationProfile" - ] - }, - "CreateConversationProfile": { - "methods": [ - "createConversationProfile" - ] - }, - "UpdateConversationProfile": { - "methods": [ - "updateConversationProfile" - ] - }, - "DeleteConversationProfile": { - "methods": [ - "deleteConversationProfile" - ] - }, - "ListConversationProfiles": { - "methods": [ - "listConversationProfiles", - "listConversationProfilesStream", - "listConversationProfilesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ConversationProfilesClient", - "rpcs": { - "GetConversationProfile": { - "methods": [ - "getConversationProfile" - ] - }, - "CreateConversationProfile": { - "methods": [ - "createConversationProfile" - ] - }, - "UpdateConversationProfile": { - "methods": [ - "updateConversationProfile" - ] - }, - "DeleteConversationProfile": { - "methods": [ - "deleteConversationProfile" - ] - }, - "ListConversationProfiles": { - "methods": [ - "listConversationProfiles", - "listConversationProfilesStream", - "listConversationProfilesAsync" - ] - } - } - } - } - }, - "Conversations": { - "clients": { - "grpc": { - "libraryClient": "ConversationsClient", - "rpcs": { - "CreateConversation": { - "methods": [ - "createConversation" - ] - }, - "GetConversation": { - "methods": [ - "getConversation" - ] - }, - "CompleteConversation": { - "methods": [ - "completeConversation" - ] - }, - "BatchCreateMessages": { - "methods": [ - "batchCreateMessages" - ] - }, - "ListConversations": { - "methods": [ - "listConversations", - "listConversationsStream", - "listConversationsAsync" - ] - }, - "ListMessages": { - "methods": [ - "listMessages", - "listMessagesStream", - "listMessagesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ConversationsClient", - "rpcs": { - "CreateConversation": { - "methods": [ - "createConversation" - ] - }, - "GetConversation": { - "methods": [ - "getConversation" - ] - }, - "CompleteConversation": { - "methods": [ - "completeConversation" - ] - }, - "BatchCreateMessages": { - "methods": [ - "batchCreateMessages" - ] - }, - "ListConversations": { - "methods": [ - "listConversations", - "listConversationsStream", - "listConversationsAsync" - ] - }, - "ListMessages": { - "methods": [ - "listMessages", - "listMessagesStream", - "listMessagesAsync" - ] - } - } - } - } - }, - "Documents": { - "clients": { - "grpc": { - "libraryClient": "DocumentsClient", - "rpcs": { - "GetDocument": { - "methods": [ - "getDocument" - ] - }, - "CreateDocument": { - "methods": [ - "createDocument" - ] - }, - "ImportDocuments": { - "methods": [ - "importDocuments" - ] - }, - "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" - ] - }, - "ImportDocuments": { - "methods": [ - "importDocuments" - ] - }, - "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": { - "GetEnvironment": { - "methods": [ - "getEnvironment" - ] - }, - "CreateEnvironment": { - "methods": [ - "createEnvironment" - ] - }, - "UpdateEnvironment": { - "methods": [ - "updateEnvironment" - ] - }, - "DeleteEnvironment": { - "methods": [ - "deleteEnvironment" - ] - }, - "ListEnvironments": { - "methods": [ - "listEnvironments", - "listEnvironmentsStream", - "listEnvironmentsAsync" - ] - }, - "GetEnvironmentHistory": { - "methods": [ - "getEnvironmentHistory", - "getEnvironmentHistoryStream", - "getEnvironmentHistoryAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "EnvironmentsClient", - "rpcs": { - "GetEnvironment": { - "methods": [ - "getEnvironment" - ] - }, - "CreateEnvironment": { - "methods": [ - "createEnvironment" - ] - }, - "UpdateEnvironment": { - "methods": [ - "updateEnvironment" - ] - }, - "DeleteEnvironment": { - "methods": [ - "deleteEnvironment" - ] - }, - "ListEnvironments": { - "methods": [ - "listEnvironments", - "listEnvironmentsStream", - "listEnvironmentsAsync" - ] - }, - "GetEnvironmentHistory": { - "methods": [ - "getEnvironmentHistory", - "getEnvironmentHistoryStream", - "getEnvironmentHistoryAsync" - ] - } - } - } - } - }, - "Fulfillments": { - "clients": { - "grpc": { - "libraryClient": "FulfillmentsClient", - "rpcs": { - "GetFulfillment": { - "methods": [ - "getFulfillment" - ] - }, - "UpdateFulfillment": { - "methods": [ - "updateFulfillment" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "FulfillmentsClient", - "rpcs": { - "GetFulfillment": { - "methods": [ - "getFulfillment" - ] - }, - "UpdateFulfillment": { - "methods": [ - "updateFulfillment" - ] - } - } - } - } - }, - "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" - ] - } - } - } - } - }, - "Participants": { - "clients": { - "grpc": { - "libraryClient": "ParticipantsClient", - "rpcs": { - "CreateParticipant": { - "methods": [ - "createParticipant" - ] - }, - "GetParticipant": { - "methods": [ - "getParticipant" - ] - }, - "UpdateParticipant": { - "methods": [ - "updateParticipant" - ] - }, - "AnalyzeContent": { - "methods": [ - "analyzeContent" - ] - }, - "SuggestArticles": { - "methods": [ - "suggestArticles" - ] - }, - "SuggestFaqAnswers": { - "methods": [ - "suggestFaqAnswers" - ] - }, - "SuggestSmartReplies": { - "methods": [ - "suggestSmartReplies" - ] - }, - "CompileSuggestion": { - "methods": [ - "compileSuggestion" - ] - }, - "ListParticipants": { - "methods": [ - "listParticipants", - "listParticipantsStream", - "listParticipantsAsync" - ] - }, - "ListSuggestions": { - "methods": [ - "listSuggestions", - "listSuggestionsStream", - "listSuggestionsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ParticipantsClient", - "rpcs": { - "CreateParticipant": { - "methods": [ - "createParticipant" - ] - }, - "GetParticipant": { - "methods": [ - "getParticipant" - ] - }, - "UpdateParticipant": { - "methods": [ - "updateParticipant" - ] - }, - "AnalyzeContent": { - "methods": [ - "analyzeContent" - ] - }, - "SuggestArticles": { - "methods": [ - "suggestArticles" - ] - }, - "SuggestFaqAnswers": { - "methods": [ - "suggestFaqAnswers" - ] - }, - "SuggestSmartReplies": { - "methods": [ - "suggestSmartReplies" - ] - }, - "CompileSuggestion": { - "methods": [ - "compileSuggestion" - ] - }, - "ListParticipants": { - "methods": [ - "listParticipants", - "listParticipantsStream", - "listParticipantsAsync" - ] - }, - "ListSuggestions": { - "methods": [ - "listSuggestions", - "listSuggestionsStream", - "listSuggestionsAsync" - ] - } - } - } - } - }, - "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" - ] - } - } - } - } - }, - "Versions": { - "clients": { - "grpc": { - "libraryClient": "VersionsClient", - "rpcs": { - "GetVersion": { - "methods": [ - "getVersion" - ] - }, - "CreateVersion": { - "methods": [ - "createVersion" - ] - }, - "UpdateVersion": { - "methods": [ - "updateVersion" - ] - }, - "DeleteVersion": { - "methods": [ - "deleteVersion" - ] - }, - "ListVersions": { - "methods": [ - "listVersions", - "listVersionsStream", - "listVersionsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "VersionsClient", - "rpcs": { - "GetVersion": { - "methods": [ - "getVersion" - ] - }, - "CreateVersion": { - "methods": [ - "createVersion" - ] - }, - "UpdateVersion": { - "methods": [ - "updateVersion" - ] - }, - "DeleteVersion": { - "methods": [ - "deleteVersion" - ] - }, - "ListVersions": { - "methods": [ - "listVersions", - "listVersionsStream", - "listVersionsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/index.ts b/owl-bot-staging/v2beta1/src/v2beta1/index.ts deleted file mode 100644 index 7214e5d9..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/index.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {AgentsClient} from './agents_client'; -export {AnswerRecordsClient} from './answer_records_client'; -export {ContextsClient} from './contexts_client'; -export {ConversationProfilesClient} from './conversation_profiles_client'; -export {ConversationsClient} from './conversations_client'; -export {DocumentsClient} from './documents_client'; -export {EntityTypesClient} from './entity_types_client'; -export {EnvironmentsClient} from './environments_client'; -export {FulfillmentsClient} from './fulfillments_client'; -export {IntentsClient} from './intents_client'; -export {KnowledgeBasesClient} from './knowledge_bases_client'; -export {ParticipantsClient} from './participants_client'; -export {SessionEntityTypesClient} from './session_entity_types_client'; -export {SessionsClient} from './sessions_client'; -export {VersionsClient} from './versions_client'; diff --git a/owl-bot-staging/v2beta1/src/v2beta1/intents_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/intents_client.ts deleted file mode 100644 index cf76593b..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/intents_client.ts +++ /dev/null @@ -1,2925 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2beta1/intents_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './intents_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2beta1.Intent|Intents}. - * @class - * @memberof v2beta1 - */ -export class IntentsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - intentsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of IntentsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof IntentsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listIntents: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'intents') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - - this.operationsClient = this._gaxModule.lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }).operationsClient(opts); - const batchUpdateIntentsResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse') as gax.protobuf.Type; - const batchUpdateIntentsMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - const batchDeleteIntentsResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const batchDeleteIntentsMetadata = protoFilesRoot.lookup( - '.google.protobuf.Struct') as gax.protobuf.Type; - - this.descriptors.longrunning = { - batchUpdateIntents: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - batchUpdateIntentsResponse.decode.bind(batchUpdateIntentsResponse), - batchUpdateIntentsMetadata.decode.bind(batchUpdateIntentsMetadata)), - batchDeleteIntents: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - batchDeleteIntentsResponse.decode.bind(batchDeleteIntentsResponse), - batchDeleteIntentsMetadata.decode.bind(batchDeleteIntentsMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2beta1.Intents', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.intentsStub) { - return this.intentsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2beta1.Intents. - this.intentsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.Intents') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2beta1.Intents, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const intentsStubMethods = - ['listIntents', 'getIntent', 'createIntent', 'updateIntent', 'deleteIntent', 'batchUpdateIntents', 'batchDeleteIntents']; - for (const methodName of intentsStubMethods) { - const callPromise = this.intentsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.intentsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getIntent( - request?: protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IIntent, - protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest|undefined, {}|undefined - ]>; - getIntent( - request: protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IIntent, - protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest|null|undefined, - {}|null|undefined>): void; - getIntent( - request: protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IIntent, - protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specified intent. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the intent. - * Supported formats: - * - * - `projects//agent/intents/` - * - `projects//locations//agent/intents/` - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView - * Optional. The resource view to apply to the returned intent. - * @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. - * The first element of the array is an object representing [Intent]{@link google.cloud.dialogflow.v2beta1.Intent}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getIntent(request); - */ - getIntent( - request?: protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IIntent, - protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IIntent, - protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IIntent, - protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getIntent(request, options, callback); - } - createIntent( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IIntent, - protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest|undefined, {}|undefined - ]>; - createIntent( - request: protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IIntent, - protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest|null|undefined, - {}|null|undefined>): void; - createIntent( - request: protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IIntent, - protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates an intent in the specified agent. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to create a intent for. - * Supported formats: - * - * - `projects//agent` - * - `projects//locations//agent` - * @param {google.cloud.dialogflow.v2beta1.Intent} request.intent - * Required. The intent to create. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView - * Optional. The resource view to apply to the returned intent. - * @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. - * The first element of the array is an object representing [Intent]{@link google.cloud.dialogflow.v2beta1.Intent}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createIntent(request); - */ - createIntent( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IIntent, - protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IIntent, - protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IIntent, - protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createIntent(request, options, callback); - } - updateIntent( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IIntent, - protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest|undefined, {}|undefined - ]>; - updateIntent( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IIntent, - protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest|null|undefined, - {}|null|undefined>): void; - updateIntent( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IIntent, - protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified intent. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2beta1.Intent} request.intent - * Required. The intent to update. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {google.protobuf.FieldMask} request.updateMask - * Optional. The mask to control which fields get updated. - * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView - * Optional. The resource view to apply to the returned intent. - * @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. - * The first element of the array is an object representing [Intent]{@link google.cloud.dialogflow.v2beta1.Intent}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateIntent(request); - */ - updateIntent( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IIntent, - protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IIntent, - protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IIntent, - protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'intent.name': request.intent!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateIntent(request, options, callback); - } - deleteIntent( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest|undefined, {}|undefined - ]>; - deleteIntent( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest|null|undefined, - {}|null|undefined>): void; - deleteIntent( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deletes the specified intent and its direct or indirect followup intents. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the intent to delete. If this intent has direct or - * indirect followup intents, we also delete them. - * - * Supported formats: - * - * - `projects//agent/intents/` - * - `projects//locations//agent/intents/` - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteIntent(request); - */ - deleteIntent( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteIntent(request, options, callback); - } - - batchUpdateIntents( - request?: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - batchUpdateIntents( - request: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchUpdateIntents( - request: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Updates/Creates multiple intents in the specified agent. - * - * Operation - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the agent to update or create intents in. - * Supported formats: - * - * - `projects//agent` - * - `projects//locations//agent` - * @param {string} request.intentBatchUri - * The URI to a Google Cloud Storage file containing intents to update or - * create. The file format can either be a serialized proto (of IntentBatch - * type) or JSON object. Note: The URI must start with "gs://". - * @param {google.cloud.dialogflow.v2beta1.IntentBatch} request.intentBatchInline - * The collection of intents to update or create. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {google.protobuf.FieldMask} request.updateMask - * Optional. The mask to control which fields get updated. - * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView - * Optional. The resource view to apply to the returned intent. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.batchUpdateIntents(request); - * const [response] = await operation.promise(); - */ - batchUpdateIntents( - request?: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.batchUpdateIntents(request, options, callback); - } -/** - * Check the status of the long running operation returned by `batchUpdateIntents()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkBatchUpdateIntentsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkBatchUpdateIntentsProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchUpdateIntents, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - batchDeleteIntents( - request?: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - batchDeleteIntents( - request: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchDeleteIntents( - request: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Deletes intents in the specified agent. - * - * Operation - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the agent to delete all entities types for. - * Supported formats: - * - * - `projects//agent` - * - `projects//locations//agent` - * @param {number[]} request.intents - * Required. The collection of intents to delete. Only intent `name` must be - * filled in. - * @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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.batchDeleteIntents(request); - * const [response] = await operation.promise(); - */ - batchDeleteIntents( - request?: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.batchDeleteIntents(request, options, callback); - } -/** - * Check the status of the long running operation returned by `batchDeleteIntents()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const decodedOperation = await checkBatchDeleteIntentsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - async checkBatchDeleteIntentsProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchDeleteIntents, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - listIntents( - request?: protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IIntent[], - protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListIntentsResponse - ]>; - listIntents( - request: protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, - protos.google.cloud.dialogflow.v2beta1.IListIntentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IIntent>): void; - listIntents( - request: protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, - protos.google.cloud.dialogflow.v2beta1.IListIntentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IIntent>): void; -/** - * Returns the list of all intents in the specified agent. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all intents from. - * Format: `projects//agent` or `projects//locations//agent`. - * - * Alternatively, you can specify the environment to list intents for. - * Format: `projects//agent/environments/` - * or `projects//locations//agent/environments/`. - * Note: training phrases of the intents will not be returned for non-draft - * environment. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView - * Optional. The resource view to apply to the returned intent. - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [Intent]{@link google.cloud.dialogflow.v2beta1.Intent}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listIntentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listIntents( - request?: protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, - protos.google.cloud.dialogflow.v2beta1.IListIntentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IIntent>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, - protos.google.cloud.dialogflow.v2beta1.IListIntentsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IIntent>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IIntent[], - protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListIntentsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listIntents(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all intents from. - * Format: `projects//agent` or `projects//locations//agent`. - * - * Alternatively, you can specify the environment to list intents for. - * Format: `projects//agent/environments/` - * or `projects//locations//agent/environments/`. - * Note: training phrases of the intents will not be returned for non-draft - * environment. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView - * Optional. The resource view to apply to the returned intent. - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Intent]{@link google.cloud.dialogflow.v2beta1.Intent} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listIntentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listIntentsStream( - request?: protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listIntents.createStream( - this.innerApiCalls.listIntents as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listIntents`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all intents from. - * Format: `projects//agent` or `projects//locations//agent`. - * - * Alternatively, you can specify the environment to list intents for. - * Format: `projects//agent/environments/` - * or `projects//locations//agent/environments/`. - * Note: training phrases of the intents will not be returned for non-draft - * environment. - * @param {string} [request.languageCode] - * Optional. The language used to access language-specific data. - * If not specified, the agent's default language is used. - * For more information, see - * [Multilingual intent and entity - * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). - * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView - * Optional. The resource view to apply to the returned intent. - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Intent]{@link google.cloud.dialogflow.v2beta1.Intent}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listIntentsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listIntentsAsync( - request?: protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listIntents.asyncIterate( - this.innerApiCalls['listIntents'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.intentsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/intents_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/intents_client_config.json deleted file mode 100644 index 7f297576..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/intents_client_config.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2beta1.Intents": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListIntents": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetIntent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateIntent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateIntent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteIntent": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "BatchUpdateIntents": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "BatchDeleteIntents": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/intents_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/intents_proto_list.json deleted file mode 100644 index cb5136f1..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/intents_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2beta1/context.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2beta1/document.proto", - "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", - "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2beta1/version.proto", - "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" -] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_client.ts deleted file mode 100644 index 66d42764..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_client.ts +++ /dev/null @@ -1,2692 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2beta1/knowledge_bases_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './knowledge_bases_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2beta1.KnowledgeBase|KnowledgeBases}. - * @class - * @memberof v2beta1 - */ -export class KnowledgeBasesClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - knowledgeBasesStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of KnowledgeBasesClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof KnowledgeBasesClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listKnowledgeBases: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'knowledgeBases') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2beta1.KnowledgeBases', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.knowledgeBasesStub) { - return this.knowledgeBasesStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2beta1.KnowledgeBases. - this.knowledgeBasesStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.KnowledgeBases') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2beta1.KnowledgeBases, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const knowledgeBasesStubMethods = - ['listKnowledgeBases', 'getKnowledgeBase', 'createKnowledgeBase', 'deleteKnowledgeBase', 'updateKnowledgeBase']; - for (const methodName of knowledgeBasesStubMethods) { - const callPromise = this.knowledgeBasesStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.knowledgeBasesStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getKnowledgeBase( - request?: protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, - protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest|undefined, {}|undefined - ]>; - getKnowledgeBase( - request: protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, - protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): void; - getKnowledgeBase( - request: protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, - protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specified knowledge base. - * - * Note: The `projects.agent.knowledgeBases` resource is deprecated; - * only use `projects.knowledgeBases`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the knowledge base to retrieve. - * 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. - * The first element of the array is an object representing [KnowledgeBase]{@link google.cloud.dialogflow.v2beta1.KnowledgeBase}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getKnowledgeBase(request); - */ - getKnowledgeBase( - request?: protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, - protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, - protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, - protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getKnowledgeBase(request, options, callback); - } - createKnowledgeBase( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, - protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest|undefined, {}|undefined - ]>; - createKnowledgeBase( - request: protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, - protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): void; - createKnowledgeBase( - request: protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, - protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates a knowledge base. - * - * Note: The `projects.agent.knowledgeBases` resource is deprecated; - * only use `projects.knowledgeBases`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to create a knowledge base for. - * Format: `projects//locations/`. - * @param {google.cloud.dialogflow.v2beta1.KnowledgeBase} request.knowledgeBase - * Required. The knowledge base to create. - * @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. - * The first element of the array is an object representing [KnowledgeBase]{@link google.cloud.dialogflow.v2beta1.KnowledgeBase}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createKnowledgeBase(request); - */ - createKnowledgeBase( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, - protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, - protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, - protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createKnowledgeBase(request, options, callback); - } - deleteKnowledgeBase( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest|undefined, {}|undefined - ]>; - deleteKnowledgeBase( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): void; - deleteKnowledgeBase( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deletes the specified knowledge base. - * - * Note: The `projects.agent.knowledgeBases` resource is deprecated; - * only use `projects.knowledgeBases`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the knowledge base to delete. - * 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. - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteKnowledgeBase(request); - */ - deleteKnowledgeBase( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteKnowledgeBase(request, options, callback); - } - updateKnowledgeBase( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, - protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest|undefined, {}|undefined - ]>; - updateKnowledgeBase( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, - protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): void; - updateKnowledgeBase( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, - protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified knowledge base. - * - * Note: The `projects.agent.knowledgeBases` resource is deprecated; - * only use `projects.knowledgeBases`. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2beta1.KnowledgeBase} request.knowledgeBase - * Required. The knowledge base to update. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Not specified means `update all`. - * Currently, only `display_name` can be updated, an InvalidArgument will be - * returned for attempting to update other fields. - * @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. - * The first element of the array is an object representing [KnowledgeBase]{@link google.cloud.dialogflow.v2beta1.KnowledgeBase}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateKnowledgeBase(request); - */ - updateKnowledgeBase( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, - protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, - protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, - protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'knowledge_base.name': request.knowledgeBase!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateKnowledgeBase(request, options, callback); - } - - listKnowledgeBases( - request?: protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase[], - protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse - ]>; - listKnowledgeBases( - request: protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, - protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase>): void; - listKnowledgeBases( - request: protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, - protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase>): void; -/** - * Returns the list of all knowledge bases of the specified agent. - * - * Note: The `projects.agent.knowledgeBases` resource is deprecated; - * only use `projects.knowledgeBases`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list of knowledge bases for. - * 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. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @param {string} request.filter - * The filter expression used to filter knowledge bases returned by the list - * method. The expression has the following syntax: - * - * [AND ] ... - * - * The following fields and operators are supported: - * - * * display_name with has(:) operator - * * language_code with equals(=) operator - * - * Examples: - * - * * 'language_code=en-us' matches knowledge bases with en-us language code. - * * 'display_name:articles' matches knowledge bases whose display name - * contains "articles". - * * 'display_name:"Best Articles"' matches knowledge bases whose display - * name contains "Best Articles". - * * 'language_code=en-gb AND display_name=articles' matches all knowledge - * bases whose display name contains "articles" and whose language code is - * "en-gb". - * - * Note: An empty filter string (i.e. "") is a no-op and will result in no - * filtering. - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @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. - * The first element of the array is Array of [KnowledgeBase]{@link google.cloud.dialogflow.v2beta1.KnowledgeBase}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listKnowledgeBasesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listKnowledgeBases( - request?: protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, - protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, - protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase[], - protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listKnowledgeBases(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list of knowledge bases for. - * 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. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @param {string} request.filter - * The filter expression used to filter knowledge bases returned by the list - * method. The expression has the following syntax: - * - * [AND ] ... - * - * The following fields and operators are supported: - * - * * display_name with has(:) operator - * * language_code with equals(=) operator - * - * Examples: - * - * * 'language_code=en-us' matches knowledge bases with en-us language code. - * * 'display_name:articles' matches knowledge bases whose display name - * contains "articles". - * * 'display_name:"Best Articles"' matches knowledge bases whose display - * name contains "Best Articles". - * * 'language_code=en-gb AND display_name=articles' matches all knowledge - * bases whose display name contains "articles" and whose language code is - * "en-gb". - * - * Note: An empty filter string (i.e. "") is a no-op and will result in no - * filtering. - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [KnowledgeBase]{@link google.cloud.dialogflow.v2beta1.KnowledgeBase} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listKnowledgeBasesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listKnowledgeBasesStream( - request?: protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listKnowledgeBases.createStream( - this.innerApiCalls.listKnowledgeBases as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listKnowledgeBases`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list of knowledge bases for. - * 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. - * @param {string} request.pageToken - * The next_page_token value returned from a previous list request. - * @param {string} request.filter - * The filter expression used to filter knowledge bases returned by the list - * method. The expression has the following syntax: - * - * [AND ] ... - * - * The following fields and operators are supported: - * - * * display_name with has(:) operator - * * language_code with equals(=) operator - * - * Examples: - * - * * 'language_code=en-us' matches knowledge bases with en-us language code. - * * 'display_name:articles' matches knowledge bases whose display name - * contains "articles". - * * 'display_name:"Best Articles"' matches knowledge bases whose display - * name contains "Best Articles". - * * 'language_code=en-gb AND display_name=articles' matches all knowledge - * bases whose display name contains "articles" and whose language code is - * "en-gb". - * - * Note: An empty filter string (i.e. "") is a no-op and will result in no - * filtering. - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [KnowledgeBase]{@link google.cloud.dialogflow.v2beta1.KnowledgeBase}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listKnowledgeBasesAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listKnowledgeBasesAsync( - request?: protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listKnowledgeBases.asyncIterate( - this.innerApiCalls['listKnowledgeBases'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.knowledgeBasesStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_client_config.json deleted file mode 100644 index f563adce..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_client_config.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2beta1.KnowledgeBases": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListKnowledgeBases": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetKnowledgeBase": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateKnowledgeBase": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteKnowledgeBase": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateKnowledgeBase": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_proto_list.json deleted file mode 100644 index cb5136f1..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/knowledge_bases_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2beta1/context.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2beta1/document.proto", - "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", - "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2beta1/version.proto", - "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" -] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/participants_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/participants_client.ts deleted file mode 100644 index e6c78308..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/participants_client.ts +++ /dev/null @@ -1,3221 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2beta1/participants_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './participants_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2beta1.Participant|Participants}. - * @class - * @memberof v2beta1 - */ -export class ParticipantsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - participantsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ParticipantsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ParticipantsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listParticipants: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'participants'), - listSuggestions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'suggestions') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2beta1.Participants', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.participantsStub) { - return this.participantsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2beta1.Participants. - this.participantsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.Participants') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2beta1.Participants, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const participantsStubMethods = - ['createParticipant', 'getParticipant', 'listParticipants', 'updateParticipant', 'analyzeContent', 'suggestArticles', 'suggestFaqAnswers', 'suggestSmartReplies', 'listSuggestions', 'compileSuggestion']; - for (const methodName of participantsStubMethods) { - const callPromise = this.participantsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.participantsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - createParticipant( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IParticipant, - protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest|undefined, {}|undefined - ]>; - createParticipant( - request: protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IParticipant, - protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest|null|undefined, - {}|null|undefined>): void; - createParticipant( - request: protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IParticipant, - protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates a new participant in a conversation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource identifier of the conversation adding the participant. - * Format: `projects//locations//conversations/`. - * @param {google.cloud.dialogflow.v2beta1.Participant} request.participant - * Required. The participant to create. - * @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. - * The first element of the array is an object representing [Participant]{@link google.cloud.dialogflow.v2beta1.Participant}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createParticipant(request); - */ - createParticipant( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IParticipant, - protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IParticipant, - protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IParticipant, - protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createParticipant(request, options, callback); - } - getParticipant( - request?: protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IParticipant, - protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest|undefined, {}|undefined - ]>; - getParticipant( - request: protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IParticipant, - protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest|null|undefined, - {}|null|undefined>): void; - getParticipant( - request: protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IParticipant, - protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves a conversation participant. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the participant. Format: - * `projects//locations//conversations//participants/`. - * @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. - * The first element of the array is an object representing [Participant]{@link google.cloud.dialogflow.v2beta1.Participant}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getParticipant(request); - */ - getParticipant( - request?: protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IParticipant, - protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IParticipant, - protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IParticipant, - protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getParticipant(request, options, callback); - } - updateParticipant( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IParticipant, - protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest|undefined, {}|undefined - ]>; - updateParticipant( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IParticipant, - protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest|null|undefined, - {}|null|undefined>): void; - updateParticipant( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IParticipant, - protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified participant. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2beta1.Participant} request.participant - * Required. The participant to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The mask to specify which fields to update. - * @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. - * The first element of the array is an object representing [Participant]{@link google.cloud.dialogflow.v2beta1.Participant}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateParticipant(request); - */ - updateParticipant( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IParticipant, - protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IParticipant, - protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IParticipant, - protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'participant.name': request.participant!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateParticipant(request, options, callback); - } - analyzeContent( - request?: protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse, - protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest|undefined, {}|undefined - ]>; - analyzeContent( - request: protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse, - protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest|null|undefined, - {}|null|undefined>): void; - analyzeContent( - request: protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse, - protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Adds a text (chat, for example), or audio (phone recording, for example) - * message from a participant into the conversation. - * - * Note: Always use agent versions for production traffic - * sent to virtual agents. 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.participant - * Required. The name of the participant this text comes from. - * Format: `projects//locations//conversations//participants/`. - * @param {google.cloud.dialogflow.v2beta1.TextInput} request.textInput - * The natural language text to be processed. - * @param {google.cloud.dialogflow.v2beta1.EventInput} request.eventInput - * An input event to send to Dialogflow. - * @param {google.cloud.dialogflow.v2beta1.OutputAudioConfig} request.replyAudioConfig - * Speech synthesis configuration. - * The speech synthesis settings for a virtual agent that may be configured - * for the associated conversation profile are not used when calling - * AnalyzeContent. If this configuration is not supplied, speech synthesis - * is disabled. - * @param {google.cloud.dialogflow.v2beta1.QueryParameters} request.queryParams - * Parameters for a Dialogflow virtual-agent query. - * @param {google.protobuf.Timestamp} request.messageSendTime - * Optional. The send time of the message from end user or human agent's - * perspective. It is used for identifying the same message under one - * participant. - * - * Given two messages under the same participant: - * - If send time are different regardless of whether the content of the - * messages are exactly the same, the conversation will regard them as - * two distinct messages sent by the participant. - * - If send time is the same regardless of whether the content of the - * messages are exactly the same, the conversation will regard them as - * same message, and ignore the message received later. - * - * If the value is not provided, a new request will always be regarded as a - * new message without any de-duplication. - * @param {string} request.requestId - * A unique identifier for this request. Restricted to 36 ASCII characters. - * A random UUID is recommended. - * This request is only idempotent if a `request_id` is provided. - * @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. - * The first element of the array is an object representing [AnalyzeContentResponse]{@link google.cloud.dialogflow.v2beta1.AnalyzeContentResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.analyzeContent(request); - */ - analyzeContent( - request?: protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse, - protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse, - protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse, - protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'participant': request.participant || '', - }); - this.initialize(); - return this.innerApiCalls.analyzeContent(request, options, callback); - } - suggestArticles( - request?: protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest|undefined, {}|undefined - ]>; - suggestArticles( - request: protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest|null|undefined, - {}|null|undefined>): void; - suggestArticles( - request: protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest|null|undefined, - {}|null|undefined>): void; -/** - * Gets suggested articles for a participant based on specific historical - * messages. - * - * Note that {@link google.cloud.dialogflow.v2beta1.Participants.ListSuggestions|ListSuggestions} will only list the auto-generated - * suggestions, while {@link google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion|CompileSuggestion} will try to compile suggestion - * based on the provided conversation context in the real time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the participant to fetch suggestion for. - * Format: `projects//locations//conversations//participants/`. - * @param {string} [request.latestMessage] - * Optional. The name of the latest conversation message to compile suggestion - * for. If empty, it will be the latest message of the conversation. - * - * Format: `projects//locations//conversations//messages/`. - * @param {number} [request.contextSize] - * Optional. Max number of messages prior to and including - * {@link google.cloud.dialogflow.v2beta1.SuggestArticlesRequest.latest_message|latest_message} to use as context - * when compiling the suggestion. By default 20 and at most 50. - * @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. - * The first element of the array is an object representing [SuggestArticlesResponse]{@link google.cloud.dialogflow.v2beta1.SuggestArticlesResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.suggestArticles(request); - */ - suggestArticles( - request?: protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.suggestArticles(request, options, callback); - } - suggestFaqAnswers( - request?: protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest|undefined, {}|undefined - ]>; - suggestFaqAnswers( - request: protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest|null|undefined, - {}|null|undefined>): void; - suggestFaqAnswers( - request: protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest|null|undefined, - {}|null|undefined>): void; -/** - * Gets suggested faq answers for a participant based on specific historical - * messages. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the participant to fetch suggestion for. - * Format: `projects//locations//conversations//participants/`. - * @param {string} [request.latestMessage] - * Optional. The name of the latest conversation message to compile suggestion - * for. If empty, it will be the latest message of the conversation. - * - * Format: `projects//locations//conversations//messages/`. - * @param {number} [request.contextSize] - * Optional. Max number of messages prior to and including - * [latest_message] to use as context when compiling the - * suggestion. By default 20 and at most 50. - * @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. - * The first element of the array is an object representing [SuggestFaqAnswersResponse]{@link google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.suggestFaqAnswers(request); - */ - suggestFaqAnswers( - request?: protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.suggestFaqAnswers(request, options, callback); - } - suggestSmartReplies( - request?: protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest|undefined, {}|undefined - ]>; - suggestSmartReplies( - request: protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest|null|undefined, - {}|null|undefined>): void; - suggestSmartReplies( - request: protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest|null|undefined, - {}|null|undefined>): void; -/** - * Gets smart replies for a participant based on specific historical - * messages. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the participant to fetch suggestion for. - * Format: `projects//locations//conversations//participants/`. - * @param {google.cloud.dialogflow.v2beta1.TextInput} request.currentTextInput - * The current natural language text segment to compile suggestion - * for. This provides a way for user to get follow up smart reply suggestion - * after a smart reply selection, without sending a text message. - * @param {string} request.latestMessage - * The name of the latest conversation message to compile suggestion - * for. If empty, it will be the latest message of the conversation. - * - * Format: `projects//locations//conversations//messages/`. - * @param {number} request.contextSize - * Optional. Max number of messages prior to and including - * [latest_message] to use as context when compiling the - * suggestion. By default 20 and at most 50. - * @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. - * The first element of the array is an object representing [SuggestSmartRepliesResponse]{@link google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.suggestSmartReplies(request); - */ - suggestSmartReplies( - request?: protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.suggestSmartReplies(request, options, callback); - } - compileSuggestion( - request?: protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse, - protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest|undefined, {}|undefined - ]>; - compileSuggestion( - request: protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse, - protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest|null|undefined, - {}|null|undefined>): void; - compileSuggestion( - request: protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse, - protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deprecated. use {@link google.cloud.dialogflow.v2beta1.Participants.SuggestArticles|SuggestArticles} and {@link google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers|SuggestFaqAnswers} instead. - * - * Gets suggestions for a participant based on specific historical - * messages. - * - * Note that {@link google.cloud.dialogflow.v2beta1.Participants.ListSuggestions|ListSuggestions} will only list the auto-generated - * suggestions, while {@link google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion|CompileSuggestion} will try to compile suggestion - * based on the provided conversation context in the real time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the participant to fetch suggestion for. - * Format: `projects//locations//conversations//participants/`. - * @param {string} request.latestMessage - * Optional. The name of the latest conversation message to compile suggestion - * for. If empty, it will be the latest message of the conversation. - * - * Format: `projects//locations//conversations//messages/`. - * @param {number} request.contextSize - * Optional. Max number of messages prior to and including - * [latest_message] to use as context when compiling the - * suggestion. If zero or less than zero, 20 is used. - * @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. - * The first element of the array is an object representing [CompileSuggestionResponse]{@link google.cloud.dialogflow.v2beta1.CompileSuggestionResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.compileSuggestion(request); - * @deprecated CompileSuggestion is deprecated and may be removed in a future version. - */ - compileSuggestion( - request?: protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse, - protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse, - protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse, - protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - this.warn('DEP$Participants-$CompileSuggestion','CompileSuggestion is deprecated and may be removed in a future version.', 'DeprecationWarning'); - return this.innerApiCalls.compileSuggestion(request, options, callback); - } - - listParticipants( - request?: protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IParticipant[], - protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListParticipantsResponse - ]>; - listParticipants( - request: protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, - protos.google.cloud.dialogflow.v2beta1.IListParticipantsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IParticipant>): void; - listParticipants( - request: protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, - protos.google.cloud.dialogflow.v2beta1.IListParticipantsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IParticipant>): void; -/** - * Returns the list of all participants in the specified conversation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The conversation to list all participants from. - * Format: `projects//locations//conversations/`. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [Participant]{@link google.cloud.dialogflow.v2beta1.Participant}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listParticipantsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listParticipants( - request?: protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, - protos.google.cloud.dialogflow.v2beta1.IListParticipantsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IParticipant>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, - protos.google.cloud.dialogflow.v2beta1.IListParticipantsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IParticipant>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IParticipant[], - protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListParticipantsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listParticipants(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The conversation to list all participants from. - * Format: `projects//locations//conversations/`. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Participant]{@link google.cloud.dialogflow.v2beta1.Participant} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listParticipantsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listParticipantsStream( - request?: protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listParticipants.createStream( - this.innerApiCalls.listParticipants as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listParticipants`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The conversation to list all participants from. - * Format: `projects//locations//conversations/`. - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Participant]{@link google.cloud.dialogflow.v2beta1.Participant}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listParticipantsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listParticipantsAsync( - request?: protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listParticipants.asyncIterate( - this.innerApiCalls['listParticipants'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - listSuggestions( - request?: protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.ISuggestion[], - protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListSuggestionsResponse - ]>; - listSuggestions( - request: protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, - protos.google.cloud.dialogflow.v2beta1.IListSuggestionsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.ISuggestion>): void; - listSuggestions( - request: protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, - protos.google.cloud.dialogflow.v2beta1.IListSuggestionsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.ISuggestion>): void; -/** - * Deprecated: Use inline suggestion, event based suggestion or - * Suggestion* API instead. - * See {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.name|HumanAgentAssistantConfig.name} for more - * details. - * Removal Date: 2020-09-01. - * - * Retrieves suggestions for live agents. - * - * This method should be used by human agent client software to fetch auto - * generated suggestions in real-time, while the conversation with an end user - * is in progress. The functionality is implemented in terms of the - * [list - * pagination](https://cloud.google.com/apis/design/design_patterns#list_pagination) - * design pattern. The client app should use the `next_page_token` field - * to fetch the next batch of suggestions. `suggestions` are sorted by - * `create_time` in descending order. - * To fetch latest suggestion, just set `page_size` to 1. - * To fetch new suggestions without duplication, send request with filter - * `create_time_epoch_microseconds > [first item's create_time of previous - * request]` and empty page_token. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the participant to fetch suggestions for. - * Format: `projects//locations//conversations//participants/`. - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. The - * default value is 100; the maximum value is 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @param {string} request.filter - * Optional. Filter on suggestions fields. Currently predicates on - * `create_time` and `create_time_epoch_microseconds` are supported. - * `create_time` only support milliseconds accuracy. E.g., - * `create_time_epoch_microseconds > 1551790877964485` or - * `create_time > "2017-01-15T01:30:15.01Z"` - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @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. - * The first element of the array is Array of [Suggestion]{@link google.cloud.dialogflow.v2beta1.Suggestion}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSuggestionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @deprecated ListSuggestions is deprecated and may be removed in a future version. - */ - listSuggestions( - request?: protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, - protos.google.cloud.dialogflow.v2beta1.IListSuggestionsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.ISuggestion>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, - protos.google.cloud.dialogflow.v2beta1.IListSuggestionsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.ISuggestion>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.ISuggestion[], - protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListSuggestionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - this.warn('DEP$Participants-$ListSuggestions','ListSuggestions is deprecated and may be removed in a future version.', 'DeprecationWarning'); - return this.innerApiCalls.listSuggestions(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the participant to fetch suggestions for. - * Format: `projects//locations//conversations//participants/`. - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. The - * default value is 100; the maximum value is 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @param {string} request.filter - * Optional. Filter on suggestions fields. Currently predicates on - * `create_time` and `create_time_epoch_microseconds` are supported. - * `create_time` only support milliseconds accuracy. E.g., - * `create_time_epoch_microseconds > 1551790877964485` or - * `create_time > "2017-01-15T01:30:15.01Z"` - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Suggestion]{@link google.cloud.dialogflow.v2beta1.Suggestion} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSuggestionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @deprecated ListSuggestions is deprecated and may be removed in a future version. - */ - listSuggestionsStream( - request?: protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - this.warn('DEP$Participants-$ListSuggestions','ListSuggestions is deprecated and may be removed in a future version.', 'DeprecationWarning'); - return this.descriptors.page.listSuggestions.createStream( - this.innerApiCalls.listSuggestions as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSuggestions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the participant to fetch suggestions for. - * Format: `projects//locations//conversations//participants/`. - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. The - * default value is 100; the maximum value is 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @param {string} request.filter - * Optional. Filter on suggestions fields. Currently predicates on - * `create_time` and `create_time_epoch_microseconds` are supported. - * `create_time` only support milliseconds accuracy. E.g., - * `create_time_epoch_microseconds > 1551790877964485` or - * `create_time > "2017-01-15T01:30:15.01Z"` - * - * For more information about filtering, see - * [API Filtering](https://aip.dev/160). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Suggestion]{@link google.cloud.dialogflow.v2beta1.Suggestion}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listSuggestionsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * @deprecated ListSuggestions is deprecated and may be removed in a future version. - */ - listSuggestionsAsync( - request?: protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - this.warn('DEP$Participants-$ListSuggestions','ListSuggestions is deprecated and may be removed in a future version.', 'DeprecationWarning'); - return this.descriptors.page.listSuggestions.asyncIterate( - this.innerApiCalls['listSuggestions'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.participantsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/participants_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/participants_client_config.json deleted file mode 100644 index be8499af..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/participants_client_config.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2beta1.Participants": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateParticipant": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetParticipant": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ListParticipants": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateParticipant": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "AnalyzeContent": { - "timeout_millis": 220000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "SuggestArticles": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "SuggestFaqAnswers": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "SuggestSmartReplies": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ListSuggestions": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CompileSuggestion": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/participants_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/participants_proto_list.json deleted file mode 100644 index cb5136f1..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/participants_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2beta1/context.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2beta1/document.proto", - "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", - "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2beta1/version.proto", - "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" -] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_client.ts deleted file mode 100644 index 57330ed8..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_client.ts +++ /dev/null @@ -1,2724 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2beta1/session_entity_types_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './session_entity_types_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2beta1.SessionEntityType|SessionEntityTypes}. - * @class - * @memberof v2beta1 - */ -export class SessionEntityTypesClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - sessionEntityTypesStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SessionEntityTypesClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SessionEntityTypesClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listSessionEntityTypes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sessionEntityTypes') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2beta1.SessionEntityTypes', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sessionEntityTypesStub) { - return this.sessionEntityTypesStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2beta1.SessionEntityTypes. - this.sessionEntityTypesStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.SessionEntityTypes') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2beta1.SessionEntityTypes, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sessionEntityTypesStubMethods = - ['listSessionEntityTypes', 'getSessionEntityType', 'createSessionEntityType', 'updateSessionEntityType', 'deleteSessionEntityType']; - for (const methodName of sessionEntityTypesStubMethods) { - const callPromise = this.sessionEntityTypesStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sessionEntityTypesStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getSessionEntityType( - request?: protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, - protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest|undefined, {}|undefined - ]>; - getSessionEntityType( - request: protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, - protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): void; - getSessionEntityType( - request: protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, - protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specified session entity type. - * - * This method doesn't work with Google Assistant integration. - * Contact Dialogflow support if you need to use session entities - * with Google Assistant integration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the session entity type. Supported formats: - * - `projects//agent/sessions//entityTypes/` - * - `projects//locations//agent/sessions//entityTypes/` - * - `projects//agent/environments//users//sessions//entityTypes/` - * - `projects//locations//agent/environments/ - * /users//sessions//entityTypes/` - * - * If `Location ID` is not specified we assume default 'us' location. If - * `Environment ID` is not specified, we assume default 'draft' environment. - * If `User ID` is not specified, we assume default '-' user. - * @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. - * The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getSessionEntityType(request); - */ - getSessionEntityType( - request?: protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, - protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, - protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, - protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getSessionEntityType(request, options, callback); - } - createSessionEntityType( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, - protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest|undefined, {}|undefined - ]>; - createSessionEntityType( - request: protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, - protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): void; - createSessionEntityType( - request: protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, - protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates a session entity type. - * - * If the specified session entity type already exists, overrides the - * session entity type. - * - * This method doesn't work with Google Assistant integration. - * Contact Dialogflow support if you need to use session entities - * with Google Assistant integration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The session to create a session entity type for. - * Supported formats: - * - `projects//agent/sessions/, - * - `projects//locations//agent/sessions/`, - * - `projects//agent/environments//users//sessions/`, - * - `projects//locations//agent/environments//users//sessions/`, - * - * If `Location ID` is not specified we assume default 'us' location. If - * `Environment ID` is not specified, we assume default 'draft' environment. - * If `User ID` is not specified, we assume default '-' user. - * @param {google.cloud.dialogflow.v2beta1.SessionEntityType} request.sessionEntityType - * Required. The session entity type to create. - * @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. - * The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createSessionEntityType(request); - */ - createSessionEntityType( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, - protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, - protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, - protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createSessionEntityType(request, options, callback); - } - updateSessionEntityType( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, - protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest|undefined, {}|undefined - ]>; - updateSessionEntityType( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, - protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): void; - updateSessionEntityType( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, - protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified session entity type. - * - * This method doesn't work with Google Assistant integration. - * Contact Dialogflow support if you need to use session entities - * with Google Assistant integration. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2beta1.SessionEntityType} request.sessionEntityType - * Required. The session entity type to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Optional. The mask to control which fields get updated. - * @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. - * The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateSessionEntityType(request); - */ - updateSessionEntityType( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, - protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, - protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, - protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'session_entity_type.name': request.sessionEntityType!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateSessionEntityType(request, options, callback); - } - deleteSessionEntityType( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest|undefined, {}|undefined - ]>; - deleteSessionEntityType( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): void; - deleteSessionEntityType( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deletes the specified session entity type. - * - * This method doesn't work with Google Assistant integration. - * Contact Dialogflow support if you need to use session entities - * with Google Assistant integration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the entity type to delete. - * Supported formats: - * - `projects//agent/sessions//entityTypes/` - * - `projects//locations//agent/sessions//entityTypes/` - * - `projects//agent/environments//users//sessions//entityTypes/` - * - `projects//locations//agent/environments/ - * /users//sessions//entityTypes/` - * - * If `Location ID` is not specified we assume default 'us' location. If - * `Environment ID` is not specified, we assume default 'draft' environment. - * If `User ID` is not specified, we assume default '-' user. - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteSessionEntityType(request); - */ - deleteSessionEntityType( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteSessionEntityType(request, options, callback); - } - - listSessionEntityTypes( - request?: protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType[], - protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse - ]>; - listSessionEntityTypes( - request: protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, - protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType>): void; - listSessionEntityTypes( - request: protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, - protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType>): void; -/** - * Returns the list of all session entity types in the specified session. - * - * This method doesn't work with Google Assistant integration. - * Contact Dialogflow support if you need to use session entities - * with Google Assistant integration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The session to list all session entity types from. - * Supported formats: - * - `projects//agent/sessions/, - * - `projects//locations//agent/sessions/`, - * - `projects//agent/environments//users//sessions/`, - * - `projects//locations//agent/environments//users//sessions/`, - * - * If `Location ID` is not specified we assume default 'us' location. If - * `Environment ID` is not specified, we assume default 'draft' environment. - * If `User ID` is not specified, we assume default '-' user. - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSessionEntityTypesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listSessionEntityTypes( - request?: protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, - protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, - protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.ISessionEntityType[], - protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listSessionEntityTypes(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The session to list all session entity types from. - * Supported formats: - * - `projects//agent/sessions/, - * - `projects//locations//agent/sessions/`, - * - `projects//agent/environments//users//sessions/`, - * - `projects//locations//agent/environments//users//sessions/`, - * - * If `Location ID` is not specified we assume default 'us' location. If - * `Environment ID` is not specified, we assume default 'draft' environment. - * If `User ID` is not specified, we assume default '-' user. - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSessionEntityTypesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listSessionEntityTypesStream( - request?: protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listSessionEntityTypes.createStream( - this.innerApiCalls.listSessionEntityTypes as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSessionEntityTypes`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The session to list all session entity types from. - * Supported formats: - * - `projects//agent/sessions/, - * - `projects//locations//agent/sessions/`, - * - `projects//agent/environments//users//sessions/`, - * - `projects//locations//agent/environments//users//sessions/`, - * - * If `Location ID` is not specified we assume default 'us' location. If - * `Environment ID` is not specified, we assume default 'draft' environment. - * If `User ID` is not specified, we assume default '-' user. - * @param {number} request.pageSize - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - * @param {string} request.pageToken - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listSessionEntityTypesAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listSessionEntityTypesAsync( - request?: protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listSessionEntityTypes.asyncIterate( - this.innerApiCalls['listSessionEntityTypes'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSession resource name string. - * - * @param {string} project - * @param {string} session - * @returns {string} Resource name string. - */ - projectAgentSessionPath(project:string,session:string) { - return this.pathTemplates.projectAgentSessionPathTemplate.render({ - project: project, - session: session, - }); - } - - /** - * Parse the project from ProjectAgentSession resource. - * - * @param {string} projectAgentSessionName - * A fully-qualified path representing project_agent_session resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionName(projectAgentSessionName: string) { - return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).project; - } - - /** - * Parse the session from ProjectAgentSession resource. - * - * @param {string} projectAgentSessionName - * A fully-qualified path representing project_agent_session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionName(projectAgentSessionName: string) { - return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).session; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.sessionEntityTypesStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_client_config.json deleted file mode 100644 index f007c235..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_client_config.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2beta1.SessionEntityTypes": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListSessionEntityTypes": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetSessionEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateSessionEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateSessionEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteSessionEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_proto_list.json deleted file mode 100644 index cb5136f1..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/session_entity_types_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2beta1/context.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2beta1/document.proto", - "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", - "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2beta1/version.proto", - "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" -] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/sessions_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/sessions_client.ts deleted file mode 100644 index c2aedf68..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/sessions_client.ts +++ /dev/null @@ -1,2482 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2beta1/sessions_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sessions_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * A service used for session interactions. - * - * For more information, see the [API interactions - * guide](https://cloud.google.com/dialogflow/docs/api-overview). - * @class - * @memberof v2beta1 - */ -export class SessionsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - sessionsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SessionsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SessionsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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. - // Provide descriptors for these. - this.descriptors.stream = { - streamingDetectIntent: new this._gaxModule.StreamDescriptor(gax.StreamType.BIDI_STREAMING) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2beta1.Sessions', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sessionsStub) { - return this.sessionsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2beta1.Sessions. - this.sessionsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.Sessions') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2beta1.Sessions, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sessionsStubMethods = - ['detectIntent', 'streamingDetectIntent']; - for (const methodName of sessionsStubMethods) { - const callPromise = this.sessionsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.stream[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sessionsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - detectIntent( - request?: protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse, - protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest|undefined, {}|undefined - ]>; - detectIntent( - request: protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse, - protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest|null|undefined, - {}|null|undefined>): void; - detectIntent( - request: protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse, - protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest|null|undefined, - {}|null|undefined>): void; -/** - * Processes a natural language query and returns structured, actionable data - * as a result. This method is not idempotent, because it may cause contexts - * and session entity types to be updated, which in turn might affect - * results of future queries. - * - * 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 - * Required. The name of the session this query is sent to. Supported formats: - * - `projects//agent/sessions/, - * - `projects//locations//agent/sessions/`, - * - `projects//agent/environments//users//sessions/`, - * - `projects//locations//agent/environments//users//sessions/`, - * - * If `Location ID` is not specified we assume default 'us' location. If - * `Environment ID` is not specified, we assume default 'draft' environment - * (`Environment ID` might be referred to as environment name at some places). - * If `User ID` is not specified, we are using "-". It's up to the API caller - * to choose an appropriate `Session ID` and `User Id`. They can be a random - * number or some type of user and session identifiers (preferably hashed). - * 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 - * Required. The input specification. It can be set to: - * - * 1. an audio config - * which instructs the speech recognizer how to process the speech audio, - * - * 2. a conversational query in the form of text, or - * - * 3. an event that specifies which intent to trigger. - * @param {google.cloud.dialogflow.v2beta1.OutputAudioConfig} request.outputAudioConfig - * Instructs the speech synthesizer how to generate the output - * audio. If this field is not set and agent-level speech synthesizer is not - * configured, no output audio is generated. - * @param {google.protobuf.FieldMask} request.outputAudioConfigMask - * Mask for {@link google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config|output_audio_config} indicating which settings in this - * request-level config should override speech synthesizer settings defined at - * agent-level. - * - * If unspecified or empty, {@link google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config|output_audio_config} replaces the agent-level - * config in its entirety. - * @param {Buffer} request.inputAudio - * The natural language speech audio to be processed. This field - * should be populated iff `query_input` is set to an input audio config. - * A single request can contain up to 1 minute of speech audio data. - * @param {object} [options] - * 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. - * The first element of the array is an object representing [DetectIntentResponse]{@link google.cloud.dialogflow.v2beta1.DetectIntentResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.detectIntent(request); - */ - detectIntent( - request?: protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse, - protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse, - protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse, - protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'session': request.session || '', - }); - this.initialize(); - return this.innerApiCalls.detectIntent(request, options, callback); - } - -/** - * Processes a natural language query in audio format in a streaming fashion - * and returns structured, actionable data as a result. This method is only - * available via the gRPC API (not REST). - * - * 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} - * An object stream which is both readable and writable. It accepts objects - * representing [StreamingDetectIntentRequest]{@link google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest} for write() method, and - * will emit objects representing [StreamingDetectIntentResponse]{@link google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse} on 'data' event asynchronously. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming) - * for more details and examples. - * @example - * const stream = client.streamingDetectIntent(); - * stream.on('data', (response) => { ... }); - * stream.on('end', () => { ... }); - * stream.write(request); - * stream.end(); - */ - streamingDetectIntent( - options?: CallOptions): - gax.CancellableStream { - this.initialize(); - return this.innerApiCalls.streamingDetectIntent(options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSession resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionPath(project:string,environment:string,user:string,session:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSession resource. - * - * @param {string} projectAgentEnvironmentUserSessionName - * A fully-qualified path representing project_agent_environment_user_session resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionName(projectAgentEnvironmentUserSessionName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match(projectAgentEnvironmentUserSessionName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSession resource. - * - * @param {string} projectAgentEnvironmentUserSessionName - * A fully-qualified path representing project_agent_environment_user_session resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionName(projectAgentEnvironmentUserSessionName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match(projectAgentEnvironmentUserSessionName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSession resource. - * - * @param {string} projectAgentEnvironmentUserSessionName - * A fully-qualified path representing project_agent_environment_user_session resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionName(projectAgentEnvironmentUserSessionName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match(projectAgentEnvironmentUserSessionName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSession resource. - * - * @param {string} projectAgentEnvironmentUserSessionName - * A fully-qualified path representing project_agent_environment_user_session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionName(projectAgentEnvironmentUserSessionName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match(projectAgentEnvironmentUserSessionName).session; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSession resource name string. - * - * @param {string} project - * @param {string} session - * @returns {string} Resource name string. - */ - projectAgentSessionPath(project:string,session:string) { - return this.pathTemplates.projectAgentSessionPathTemplate.render({ - project: project, - session: session, - }); - } - - /** - * Parse the project from ProjectAgentSession resource. - * - * @param {string} projectAgentSessionName - * A fully-qualified path representing project_agent_session resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionName(projectAgentSessionName: string) { - return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).project; - } - - /** - * Parse the session from ProjectAgentSession resource. - * - * @param {string} projectAgentSessionName - * A fully-qualified path representing project_agent_session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionName(projectAgentSessionName: string) { - return this.pathTemplates.projectAgentSessionPathTemplate.match(projectAgentSessionName).session; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSession resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionPath(project:string,location:string,environment:string,user:string,session:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSession resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionName - * A fully-qualified path representing project_location_agent_environment_user_session resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionName(projectLocationAgentEnvironmentUserSessionName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match(projectLocationAgentEnvironmentUserSessionName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSession resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionName - * A fully-qualified path representing project_location_agent_environment_user_session resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionName(projectLocationAgentEnvironmentUserSessionName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match(projectLocationAgentEnvironmentUserSessionName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSession resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionName - * A fully-qualified path representing project_location_agent_environment_user_session resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionName(projectLocationAgentEnvironmentUserSessionName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match(projectLocationAgentEnvironmentUserSessionName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSession resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionName - * A fully-qualified path representing project_location_agent_environment_user_session resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionName(projectLocationAgentEnvironmentUserSessionName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match(projectLocationAgentEnvironmentUserSessionName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSession resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionName - * A fully-qualified path representing project_location_agent_environment_user_session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionName(projectLocationAgentEnvironmentUserSessionName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match(projectLocationAgentEnvironmentUserSessionName).session; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSession resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @returns {string} Resource name string. - */ - projectLocationAgentSessionPath(project:string,location:string,session:string) { - return this.pathTemplates.projectLocationAgentSessionPathTemplate.render({ - project: project, - location: location, - session: session, - }); - } - - /** - * Parse the project from ProjectLocationAgentSession resource. - * - * @param {string} projectLocationAgentSessionName - * A fully-qualified path representing project_location_agent_session resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionName(projectLocationAgentSessionName: string) { - return this.pathTemplates.projectLocationAgentSessionPathTemplate.match(projectLocationAgentSessionName).project; - } - - /** - * Parse the location from ProjectLocationAgentSession resource. - * - * @param {string} projectLocationAgentSessionName - * A fully-qualified path representing project_location_agent_session resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionName(projectLocationAgentSessionName: string) { - return this.pathTemplates.projectLocationAgentSessionPathTemplate.match(projectLocationAgentSessionName).location; - } - - /** - * Parse the session from ProjectLocationAgentSession resource. - * - * @param {string} projectLocationAgentSessionName - * A fully-qualified path representing project_location_agent_session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionName(projectLocationAgentSessionName: string) { - return this.pathTemplates.projectLocationAgentSessionPathTemplate.match(projectLocationAgentSessionName).session; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.sessionsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/sessions_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/sessions_client_config.json deleted file mode 100644 index e36850ea..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/sessions_client_config.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2beta1.Sessions": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "DetectIntent": { - "timeout_millis": 220000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "StreamingDetectIntent": { - "timeout_millis": 220000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/sessions_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/sessions_proto_list.json deleted file mode 100644 index cb5136f1..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/sessions_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2beta1/context.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2beta1/document.proto", - "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", - "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2beta1/version.proto", - "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" -] diff --git a/owl-bot-staging/v2beta1/src/v2beta1/versions_client.ts b/owl-bot-staging/v2beta1/src/v2beta1/versions_client.ts deleted file mode 100644 index 9da368e3..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/versions_client.ts +++ /dev/null @@ -1,2613 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2beta1/versions_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './versions_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for managing {@link google.cloud.dialogflow.v2beta1.Version|Versions}. - * @class - * @memberof v2beta1 - */ -export class VersionsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - versionsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of VersionsClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof VersionsClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectAgentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent' - ), - projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/entityTypes/{entity_type}' - ), - projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}' - ), - projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/fulfillment' - ), - projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/intents/{intent}' - ), - projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/contexts/{context}' - ), - projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/agent/versions/{version}' - ), - projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/answerRecords/{answer_record}' - ), - projectConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}' - ), - projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/messages/{message}' - ), - projectConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversations/{conversation}/participants/{participant}' - ), - projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationProfiles/{conversation_profile}' - ), - 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' - ), - projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' - ), - projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}' - ), - projectLocationAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' - ), - projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/fulfillment' - ), - projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/intents/{intent}' - ), - projectLocationAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' - ), - projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' - ), - projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/agent/versions/{version}' - ), - projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/answerRecords/{answer_record}' - ), - projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - projectLocationConversationMessagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' - ), - projectLocationConversationParticipantPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' - ), - projectLocationConversationProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' - ), - 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, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listVersions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'versions') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2beta1.Versions', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.versionsStub) { - return this.versionsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2beta1.Versions. - this.versionsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2beta1.Versions') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2beta1.Versions, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const versionsStubMethods = - ['listVersions', 'getVersion', 'createVersion', 'updateVersion', 'deleteVersion']; - for (const methodName of versionsStubMethods) { - const callPromise = this.versionsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.versionsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dialogflow.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'dialogflow.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/dialogflow' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getVersion( - request?: protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IVersion, - protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest|undefined, {}|undefined - ]>; - getVersion( - request: protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IVersion, - protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest|null|undefined, - {}|null|undefined>): void; - getVersion( - request: protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IVersion, - protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest|null|undefined, - {}|null|undefined>): void; -/** - * Retrieves the specified agent version. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the version. - * Supported formats: - * - `projects//agent/versions/` - * - `projects//locations//agent/versions/` - * @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. - * The first element of the array is an object representing [Version]{@link google.cloud.dialogflow.v2beta1.Version}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getVersion(request); - */ - getVersion( - request?: protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IVersion, - protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IVersion, - protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IVersion, - protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getVersion(request, options, callback); - } - createVersion( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IVersion, - protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest|undefined, {}|undefined - ]>; - createVersion( - request: protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IVersion, - protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest|null|undefined, - {}|null|undefined>): void; - createVersion( - request: protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IVersion, - protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates an agent version. - * - * The new version points to the agent instance in the "default" environment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to create a version for. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - * @param {google.cloud.dialogflow.v2beta1.Version} request.version - * Required. The version to create. - * @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. - * The first element of the array is an object representing [Version]{@link google.cloud.dialogflow.v2beta1.Version}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createVersion(request); - */ - createVersion( - request?: protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IVersion, - protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IVersion, - protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IVersion, - protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createVersion(request, options, callback); - } - updateVersion( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IVersion, - protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest|undefined, {}|undefined - ]>; - updateVersion( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IVersion, - protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest|null|undefined, - {}|null|undefined>): void; - updateVersion( - request: protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.IVersion, - protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates the specified agent version. - * - * Note that this method does not allow you to update the state of the agent - * the given version points to. It allows you to update only mutable - * properties of the version resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dialogflow.v2beta1.Version} request.version - * Required. The version to update. - * Supported formats: - * - `projects//agent/versions/` - * - `projects//locations//agent/versions/` - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The mask to control which fields get updated. - * @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. - * The first element of the array is an object representing [Version]{@link google.cloud.dialogflow.v2beta1.Version}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateVersion(request); - */ - updateVersion( - request?: protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.IVersion, - protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.IVersion, - protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IVersion, - protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'version.name': request.version!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateVersion(request, options, callback); - } - deleteVersion( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest|undefined, {}|undefined - ]>; - deleteVersion( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest|null|undefined, - {}|null|undefined>): void; - deleteVersion( - request: protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest|null|undefined, - {}|null|undefined>): void; -/** - * Delete the specified agent version. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the version to delete. - * Supported formats: - * - `projects//agent/versions/` - * - `projects//locations//agent/versions/` - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteVersion(request); - */ - deleteVersion( - request?: protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteVersion(request, options, callback); - } - - listVersions( - request?: protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IVersion[], - protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListVersionsResponse - ]>; - listVersions( - request: protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, - protos.google.cloud.dialogflow.v2beta1.IListVersionsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IVersion>): void; - listVersions( - request: protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, - protos.google.cloud.dialogflow.v2beta1.IListVersionsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IVersion>): void; -/** - * Returns the list of all versions of the specified agent. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all versions from. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @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. - * The first element of the array is Array of [Version]{@link google.cloud.dialogflow.v2beta1.Version}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listVersionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listVersions( - request?: protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, - protos.google.cloud.dialogflow.v2beta1.IListVersionsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IVersion>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, - protos.google.cloud.dialogflow.v2beta1.IListVersionsResponse|null|undefined, - protos.google.cloud.dialogflow.v2beta1.IVersion>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.IVersion[], - protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest|null, - protos.google.cloud.dialogflow.v2beta1.IListVersionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listVersions(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all versions from. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Version]{@link google.cloud.dialogflow.v2beta1.Version} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listVersionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listVersionsStream( - request?: protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listVersions.createStream( - this.innerApiCalls.listVersions as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listVersions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The agent to list all versions from. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous list request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Version]{@link google.cloud.dialogflow.v2beta1.Version}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listVersionsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listVersionsAsync( - request?: protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listVersions.asyncIterate( - this.innerApiCalls['listVersions'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectAgent resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentPath(project:string) { - return this.pathTemplates.projectAgentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgent resource. - * - * @param {string} projectAgentName - * A fully-qualified path representing project_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentName(projectAgentName: string) { - return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName).project; - } - - /** - * Return a fully-qualified projectAgentEntityType resource name string. - * - * @param {string} project - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEntityTypePath(project:string,entityType:string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ - project: project, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).project; - } - - /** - * Parse the entity_type from ProjectAgentEntityType resource. - * - * @param {string} projectAgentEntityTypeName - * A fully-qualified path representing project_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEntityTypeName(projectAgentEntityTypeName: string) { - return this.pathTemplates.projectAgentEntityTypePathTemplate.match(projectAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} environment - * @returns {string} Resource name string. - */ - projectAgentEnvironmentPath(project:string,environment:string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ - project: project, - environment: environment, - }); - } - - /** - * Parse the project from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironment resource. - * - * @param {string} projectAgentEnvironmentName - * A fully-qualified path representing project_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentName(projectAgentEnvironmentName: string) { - return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(projectAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionContextPath(project:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match(projectAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentEnvironmentUserSessionEntityTypePath(project:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentFulfillment resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectAgentFulfillmentPath(project:string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectAgentFulfillment resource. - * - * @param {string} projectAgentFulfillmentName - * A fully-qualified path representing project_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentFulfillmentName(projectAgentFulfillmentName: string) { - return this.pathTemplates.projectAgentFulfillmentPathTemplate.match(projectAgentFulfillmentName).project; - } - - /** - * Return a fully-qualified projectAgentIntent resource name string. - * - * @param {string} project - * @param {string} intent - * @returns {string} Resource name string. - */ - projectAgentIntentPath(project:string,intent:string) { - return this.pathTemplates.projectAgentIntentPathTemplate.render({ - project: project, - intent: intent, - }); - } - - /** - * Parse the project from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).project; - } - - /** - * Parse the intent from ProjectAgentIntent resource. - * - * @param {string} projectAgentIntentName - * A fully-qualified path representing project_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { - return this.pathTemplates.projectAgentIntentPathTemplate.match(projectAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectAgentSessionContextPath(project:string,session:string,context:string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ - project: project, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).project; - } - - /** - * Parse the session from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectAgentSessionContext resource. - * - * @param {string} projectAgentSessionContextName - * A fully-qualified path representing project_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName: string) { - return this.pathTemplates.projectAgentSessionContextPathTemplate.match(projectAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectAgentSessionEntityTypePath(project:string,session:string,entityType:string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ - project: project, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).project; - } - - /** - * Parse the session from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectAgentSessionEntityType resource. - * - * @param {string} projectAgentSessionEntityTypeName - * A fully-qualified path representing project_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match(projectAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectAgentVersion resource name string. - * - * @param {string} project - * @param {string} version - * @returns {string} Resource name string. - */ - projectAgentVersionPath(project:string,version:string) { - return this.pathTemplates.projectAgentVersionPathTemplate.render({ - project: project, - version: version, - }); - } - - /** - * Parse the project from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).project; - } - - /** - * Parse the version from ProjectAgentVersion resource. - * - * @param {string} projectAgentVersionName - * A fully-qualified path representing project_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { - return this.pathTemplates.projectAgentVersionPathTemplate.match(projectAgentVersionName).version; - } - - /** - * Return a fully-qualified projectAnswerRecord resource name string. - * - * @param {string} project - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectAnswerRecordPath(project:string,answerRecord:string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.render({ - project: project, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).project; - } - - /** - * Parse the answer_record from ProjectAnswerRecord resource. - * - * @param {string} projectAnswerRecordName - * A fully-qualified path representing project_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectAnswerRecordName(projectAnswerRecordName: string) { - return this.pathTemplates.projectAnswerRecordPathTemplate.match(projectAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectConversation resource name string. - * - * @param {string} project - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectConversationPath(project:string,conversation:string) { - return this.pathTemplates.projectConversationPathTemplate.render({ - project: project, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).project; - } - - /** - * Parse the conversation from ProjectConversation resource. - * - * @param {string} projectConversationName - * A fully-qualified path representing project_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationName(projectConversationName: string) { - return this.pathTemplates.projectConversationPathTemplate.match(projectConversationName).conversation; - } - - /** - * Return a fully-qualified projectConversationMessage resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectConversationMessagePath(project:string,conversation:string,message:string) { - return this.pathTemplates.projectConversationMessagePathTemplate.render({ - project: project, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).project; - } - - /** - * Parse the conversation from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectConversationMessage resource. - * - * @param {string} projectConversationMessageName - * A fully-qualified path representing project_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectConversationMessageName(projectConversationMessageName: string) { - return this.pathTemplates.projectConversationMessagePathTemplate.match(projectConversationMessageName).message; - } - - /** - * Return a fully-qualified projectConversationParticipant resource name string. - * - * @param {string} project - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectConversationParticipantPath(project:string,conversation:string,participant:string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.render({ - project: project, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).project; - } - - /** - * Parse the conversation from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectConversationParticipant resource. - * - * @param {string} projectConversationParticipantName - * A fully-qualified path representing project_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectConversationParticipantName(projectConversationParticipantName: string) { - return this.pathTemplates.projectConversationParticipantPathTemplate.match(projectConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectConversationProfile resource name string. - * - * @param {string} project - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectConversationProfilePath(project:string,conversationProfile:string) { - return this.pathTemplates.projectConversationProfilePathTemplate.render({ - project: project, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).project; - } - - /** - * Parse the conversation_profile from ProjectConversationProfile resource. - * - * @param {string} projectConversationProfileName - * A fully-qualified path representing project_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectConversationProfileName(projectConversationProfileName: string) { - return this.pathTemplates.projectConversationProfilePathTemplate.match(projectConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).project; - } - - /** - * Parse the location from ProjectLocationAgent resource. - * - * @param {string} projectLocationAgentName - * A fully-qualified path representing project_location_agent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { - return this.pathTemplates.projectLocationAgentPathTemplate.match(projectLocationAgentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEntityTypePath(project:string,location:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render({ - project: project, - location: location, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).location; - } - - /** - * Parse the entity_type from ProjectLocationAgentEntityType resource. - * - * @param {string} projectLocationAgentEntityTypeName - * A fully-qualified path representing project_location_agent_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEntityTypeName(projectLocationAgentEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match(projectLocationAgentEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentPath(project:string,location:string,environment:string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render({ - project: project, - location: location, - environment: environment, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironment resource. - * - * @param {string} projectLocationAgentEnvironmentName - * A fully-qualified path representing project_location_agent_environment resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentName(projectLocationAgentEnvironmentName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(projectLocationAgentEnvironmentName).environment; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionContextPath(project:string,location:string,environment:string,user:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionContextName - * A fully-qualified path representing project_location_agent_environment_user_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(projectLocationAgentEnvironmentUserSessionContextName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match(projectLocationAgentEnvironmentUserSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} environment - * @param {string} user - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentEnvironmentUserSessionEntityTypePath(project:string,location:string,environment:string,user:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render({ - project: project, - location: location, - environment: environment, - user: user, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).location; - } - - /** - * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the environment. - */ - matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).environment; - } - - /** - * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the user. - */ - matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).user; - } - - /** - * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. - * - * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName - * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(projectLocationAgentEnvironmentUserSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match(projectLocationAgentEnvironmentUserSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentFulfillment resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - projectLocationAgentFulfillmentPath(project:string,location:string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).project; - } - - /** - * Parse the location from ProjectLocationAgentFulfillment resource. - * - * @param {string} projectLocationAgentFulfillmentName - * A fully-qualified path representing project_location_agent_fulfillment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentFulfillmentName(projectLocationAgentFulfillmentName: string) { - return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match(projectLocationAgentFulfillmentName).location; - } - - /** - * Return a fully-qualified projectLocationAgentIntent resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} intent - * @returns {string} Resource name string. - */ - projectLocationAgentIntentPath(project:string,location:string,intent:string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ - project: project, - location: location, - intent: intent, - }); - } - - /** - * Parse the project from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).project; - } - - /** - * Parse the location from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).location; - } - - /** - * Parse the intent from ProjectLocationAgentIntent resource. - * - * @param {string} projectLocationAgentIntentName - * A fully-qualified path representing project_location_agent_intent resource. - * @returns {string} A string representing the intent. - */ - matchIntentFromProjectLocationAgentIntentName(projectLocationAgentIntentName: string) { - return this.pathTemplates.projectLocationAgentIntentPathTemplate.match(projectLocationAgentIntentName).intent; - } - - /** - * Return a fully-qualified projectLocationAgentSessionContext resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} context - * @returns {string} Resource name string. - */ - projectLocationAgentSessionContextPath(project:string,location:string,session:string,context:string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render({ - project: project, - location: location, - session: session, - context: context, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).session; - } - - /** - * Parse the context from ProjectLocationAgentSessionContext resource. - * - * @param {string} projectLocationAgentSessionContextName - * A fully-qualified path representing project_location_agent_session_context resource. - * @returns {string} A string representing the context. - */ - matchContextFromProjectLocationAgentSessionContextName(projectLocationAgentSessionContextName: string) { - return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match(projectLocationAgentSessionContextName).context; - } - - /** - * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @param {string} entity_type - * @returns {string} Resource name string. - */ - projectLocationAgentSessionEntityTypePath(project:string,location:string,session:string,entityType:string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render({ - project: project, - location: location, - session: session, - entity_type: entityType, - }); - } - - /** - * Parse the project from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).project; - } - - /** - * Parse the location from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).location; - } - - /** - * Parse the session from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the session. - */ - matchSessionFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).session; - } - - /** - * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. - * - * @param {string} projectLocationAgentSessionEntityTypeName - * A fully-qualified path representing project_location_agent_session_entity_type resource. - * @returns {string} A string representing the entity_type. - */ - matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(projectLocationAgentSessionEntityTypeName: string) { - return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match(projectLocationAgentSessionEntityTypeName).entity_type; - } - - /** - * Return a fully-qualified projectLocationAgentVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} version - * @returns {string} Resource name string. - */ - projectLocationAgentVersionPath(project:string,location:string,version:string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ - project: project, - location: location, - version: version, - }); - } - - /** - * Parse the project from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).project; - } - - /** - * Parse the location from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).location; - } - - /** - * Parse the version from ProjectLocationAgentVersion resource. - * - * @param {string} projectLocationAgentVersionName - * A fully-qualified path representing project_location_agent_version resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationAgentVersionName(projectLocationAgentVersionName: string) { - return this.pathTemplates.projectLocationAgentVersionPathTemplate.match(projectLocationAgentVersionName).version; - } - - /** - * Return a fully-qualified projectLocationAnswerRecord resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} answer_record - * @returns {string} Resource name string. - */ - projectLocationAnswerRecordPath(project:string,location:string,answerRecord:string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ - project: project, - location: location, - answer_record: answerRecord, - }); - } - - /** - * Parse the project from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).project; - } - - /** - * Parse the location from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).location; - } - - /** - * Parse the answer_record from ProjectLocationAnswerRecord resource. - * - * @param {string} projectLocationAnswerRecordName - * A fully-qualified path representing project_location_answer_record resource. - * @returns {string} A string representing the answer_record. - */ - matchAnswerRecordFromProjectLocationAnswerRecordName(projectLocationAnswerRecordName: string) { - return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match(projectLocationAnswerRecordName).answer_record; - } - - /** - * Return a fully-qualified projectLocationConversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - projectLocationConversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.projectLocationConversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).project; - } - - /** - * Parse the location from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).location; - } - - /** - * Parse the conversation from ProjectLocationConversation resource. - * - * @param {string} projectLocationConversationName - * A fully-qualified path representing project_location_conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationName(projectLocationConversationName: string) { - return this.pathTemplates.projectLocationConversationPathTemplate.match(projectLocationConversationName).conversation; - } - - /** - * Return a fully-qualified projectLocationConversationMessage resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} message - * @returns {string} Resource name string. - */ - projectLocationConversationMessagePath(project:string,location:string,conversation:string,message:string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.render({ - project: project, - location: location, - conversation: conversation, - message: message, - }); - } - - /** - * Parse the project from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).project; - } - - /** - * Parse the location from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).conversation; - } - - /** - * Parse the message from ProjectLocationConversationMessage resource. - * - * @param {string} projectLocationConversationMessageName - * A fully-qualified path representing project_location_conversation_message resource. - * @returns {string} A string representing the message. - */ - matchMessageFromProjectLocationConversationMessageName(projectLocationConversationMessageName: string) { - return this.pathTemplates.projectLocationConversationMessagePathTemplate.match(projectLocationConversationMessageName).message; - } - - /** - * Return a fully-qualified projectLocationConversationParticipant resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} participant - * @returns {string} Resource name string. - */ - projectLocationConversationParticipantPath(project:string,location:string,conversation:string,participant:string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - participant: participant, - }); - } - - /** - * Parse the project from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).project; - } - - /** - * Parse the location from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).location; - } - - /** - * Parse the conversation from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).conversation; - } - - /** - * Parse the participant from ProjectLocationConversationParticipant resource. - * - * @param {string} projectLocationConversationParticipantName - * A fully-qualified path representing project_location_conversation_participant resource. - * @returns {string} A string representing the participant. - */ - matchParticipantFromProjectLocationConversationParticipantName(projectLocationConversationParticipantName: string) { - return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match(projectLocationConversationParticipantName).participant; - } - - /** - * Return a fully-qualified projectLocationConversationProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_profile - * @returns {string} Resource name string. - */ - projectLocationConversationProfilePath(project:string,location:string,conversationProfile:string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.render({ - project: project, - location: location, - conversation_profile: conversationProfile, - }); - } - - /** - * Parse the project from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).project; - } - - /** - * Parse the location from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).location; - } - - /** - * Parse the conversation_profile from ProjectLocationConversationProfile resource. - * - * @param {string} projectLocationConversationProfileName - * A fully-qualified path representing project_location_conversation_profile resource. - * @returns {string} A string representing the conversation_profile. - */ - matchConversationProfileFromProjectLocationConversationProfileName(projectLocationConversationProfileName: string) { - return this.pathTemplates.projectLocationConversationProfilePathTemplate.match(projectLocationConversationProfileName).conversation_profile; - } - - /** - * 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. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.versionsStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/versions_client_config.json b/owl-bot-staging/v2beta1/src/v2beta1/versions_client_config.json deleted file mode 100644 index e748590d..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/versions_client_config.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2beta1.Versions": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListVersions": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetVersion": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateVersion": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateVersion": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteVersion": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2beta1/src/v2beta1/versions_proto_list.json b/owl-bot-staging/v2beta1/src/v2beta1/versions_proto_list.json deleted file mode 100644 index cb5136f1..00000000 --- a/owl-bot-staging/v2beta1/src/v2beta1/versions_proto_list.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", - "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", - "../../protos/google/cloud/dialogflow/v2beta1/context.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", - "../../protos/google/cloud/dialogflow/v2beta1/document.proto", - "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", - "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", - "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", - "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", - "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", - "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session.proto", - "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", - "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", - "../../protos/google/cloud/dialogflow/v2beta1/version.proto", - "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" -] diff --git a/owl-bot-staging/v2beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v2beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 85cdb2d0..00000000 --- a/owl-bot-staging/v2beta1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const dialogflow = require('@google-cloud/dialogflow'); - -function main() { - const agentsClient = new dialogflow.AgentsClient(); - const answerRecordsClient = new dialogflow.AnswerRecordsClient(); - const contextsClient = new dialogflow.ContextsClient(); - const conversationProfilesClient = new dialogflow.ConversationProfilesClient(); - const conversationsClient = new dialogflow.ConversationsClient(); - const documentsClient = new dialogflow.DocumentsClient(); - const entityTypesClient = new dialogflow.EntityTypesClient(); - const environmentsClient = new dialogflow.EnvironmentsClient(); - const fulfillmentsClient = new dialogflow.FulfillmentsClient(); - const intentsClient = new dialogflow.IntentsClient(); - const knowledgeBasesClient = new dialogflow.KnowledgeBasesClient(); - const participantsClient = new dialogflow.ParticipantsClient(); - const sessionEntityTypesClient = new dialogflow.SessionEntityTypesClient(); - const sessionsClient = new dialogflow.SessionsClient(); - const versionsClient = new dialogflow.VersionsClient(); -} - -main(); diff --git a/owl-bot-staging/v2beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v2beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 5a454ee2..00000000 --- a/owl-bot-staging/v2beta1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {AgentsClient, AnswerRecordsClient, ContextsClient, ConversationProfilesClient, ConversationsClient, DocumentsClient, EntityTypesClient, EnvironmentsClient, FulfillmentsClient, IntentsClient, KnowledgeBasesClient, ParticipantsClient, SessionEntityTypesClient, SessionsClient, VersionsClient} from '@google-cloud/dialogflow'; - -// check that the client class type name can be used -function doStuffWithAgentsClient(client: AgentsClient) { - client.close(); -} -function doStuffWithAnswerRecordsClient(client: AnswerRecordsClient) { - client.close(); -} -function doStuffWithContextsClient(client: ContextsClient) { - client.close(); -} -function doStuffWithConversationProfilesClient(client: ConversationProfilesClient) { - client.close(); -} -function doStuffWithConversationsClient(client: ConversationsClient) { - client.close(); -} -function doStuffWithDocumentsClient(client: DocumentsClient) { - client.close(); -} -function doStuffWithEntityTypesClient(client: EntityTypesClient) { - client.close(); -} -function doStuffWithEnvironmentsClient(client: EnvironmentsClient) { - client.close(); -} -function doStuffWithFulfillmentsClient(client: FulfillmentsClient) { - client.close(); -} -function doStuffWithIntentsClient(client: IntentsClient) { - client.close(); -} -function doStuffWithKnowledgeBasesClient(client: KnowledgeBasesClient) { - client.close(); -} -function doStuffWithParticipantsClient(client: ParticipantsClient) { - client.close(); -} -function doStuffWithSessionEntityTypesClient(client: SessionEntityTypesClient) { - client.close(); -} -function doStuffWithSessionsClient(client: SessionsClient) { - client.close(); -} -function doStuffWithVersionsClient(client: VersionsClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const agentsClient = new AgentsClient(); - doStuffWithAgentsClient(agentsClient); - // check that the client instance can be created - const answerRecordsClient = new AnswerRecordsClient(); - doStuffWithAnswerRecordsClient(answerRecordsClient); - // check that the client instance can be created - const contextsClient = new ContextsClient(); - doStuffWithContextsClient(contextsClient); - // check that the client instance can be created - const conversationProfilesClient = new ConversationProfilesClient(); - doStuffWithConversationProfilesClient(conversationProfilesClient); - // check that the client instance can be created - const conversationsClient = new ConversationsClient(); - doStuffWithConversationsClient(conversationsClient); - // check that the client instance can be created - const documentsClient = new DocumentsClient(); - doStuffWithDocumentsClient(documentsClient); - // check that the client instance can be created - const entityTypesClient = new EntityTypesClient(); - doStuffWithEntityTypesClient(entityTypesClient); - // check that the client instance can be created - const environmentsClient = new EnvironmentsClient(); - doStuffWithEnvironmentsClient(environmentsClient); - // check that the client instance can be created - const fulfillmentsClient = new FulfillmentsClient(); - doStuffWithFulfillmentsClient(fulfillmentsClient); - // check that the client instance can be created - const intentsClient = new IntentsClient(); - doStuffWithIntentsClient(intentsClient); - // check that the client instance can be created - const knowledgeBasesClient = new KnowledgeBasesClient(); - doStuffWithKnowledgeBasesClient(knowledgeBasesClient); - // check that the client instance can be created - const participantsClient = new ParticipantsClient(); - doStuffWithParticipantsClient(participantsClient); - // check that the client instance can be created - const sessionEntityTypesClient = new SessionEntityTypesClient(); - doStuffWithSessionEntityTypesClient(sessionEntityTypesClient); - // check that the client instance can be created - const sessionsClient = new SessionsClient(); - doStuffWithSessionsClient(sessionsClient); - // check that the client instance can be created - const versionsClient = new VersionsClient(); - doStuffWithVersionsClient(versionsClient); -} - -main(); diff --git a/owl-bot-staging/v2beta1/system-test/install.ts b/owl-bot-staging/v2beta1/system-test/install.ts deleted file mode 100644 index 1f850b52..00000000 --- a/owl-bot-staging/v2beta1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v2beta1/test/gapic_agents_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_agents_v2beta1.ts deleted file mode 100644 index 43ccffa5..00000000 --- a/owl-bot-staging/v2beta1/test/gapic_agents_v2beta1.ts +++ /dev/null @@ -1,2926 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as agentsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2beta1.AgentsClient', () => { - it('has servicePath', () => { - const servicePath = agentsModule.v2beta1.AgentsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = agentsModule.v2beta1.AgentsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = agentsModule.v2beta1.AgentsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new agentsModule.v2beta1.AgentsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new agentsModule.v2beta1.AgentsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.agentsStub, undefined); - await client.initialize(); - assert(client.agentsStub); - }); - - it('has close method', () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getAgent', () => { - it('invokes getAgent without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()); - client.innerApiCalls.getAgent = stubSimpleCall(expectedResponse); - const [response] = await client.getAgent(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getAgent without error using callback', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()); - client.innerApiCalls.getAgent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAgent( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IAgent|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getAgent with error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getAgent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAgent(request), expectedError); - assert((client.innerApiCalls.getAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('setAgent', () => { - it('invokes setAgent without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SetAgentRequest()); - request.agent = {}; - request.agent.parent = ''; - const expectedHeaderRequestParams = "agent.parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()); - client.innerApiCalls.setAgent = stubSimpleCall(expectedResponse); - const [response] = await client.setAgent(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes setAgent without error using callback', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SetAgentRequest()); - request.agent = {}; - request.agent.parent = ''; - const expectedHeaderRequestParams = "agent.parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()); - client.innerApiCalls.setAgent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setAgent( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IAgent|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes setAgent with error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SetAgentRequest()); - request.agent = {}; - request.agent.parent = ''; - const expectedHeaderRequestParams = "agent.parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.setAgent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setAgent(request), expectedError); - assert((client.innerApiCalls.setAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteAgent', () => { - it('invokes deleteAgent without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteAgent = stubSimpleCall(expectedResponse); - const [response] = await client.deleteAgent(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteAgent without error using callback', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteAgent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAgent( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteAgent with error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAgent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteAgent(request), expectedError); - assert((client.innerApiCalls.deleteAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getValidationResult', () => { - it('invokes getValidationResult without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetValidationResultRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ValidationResult()); - client.innerApiCalls.getValidationResult = stubSimpleCall(expectedResponse); - const [response] = await client.getValidationResult(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getValidationResult as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getValidationResult without error using callback', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetValidationResultRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ValidationResult()); - client.innerApiCalls.getValidationResult = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getValidationResult( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IValidationResult|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getValidationResult as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getValidationResult with error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetValidationResultRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getValidationResult = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getValidationResult(request), expectedError); - assert((client.innerApiCalls.getValidationResult as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('trainAgent', () => { - it('invokes trainAgent without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.TrainAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.trainAgent = stubLongRunningCall(expectedResponse); - const [operation] = await client.trainAgent(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes trainAgent without error using callback', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.TrainAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.trainAgent = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.trainAgent( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes trainAgent with call error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.TrainAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.trainAgent = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.trainAgent(request), expectedError); - assert((client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes trainAgent with LRO error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.TrainAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.trainAgent = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.trainAgent(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkTrainAgentProgress without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkTrainAgentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkTrainAgentProgress with error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkTrainAgentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('exportAgent', () => { - it('invokes exportAgent without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ExportAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.exportAgent = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportAgent(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes exportAgent without error using callback', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ExportAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.exportAgent = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportAgent( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes exportAgent with call error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ExportAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.exportAgent = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportAgent(request), expectedError); - assert((client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes exportAgent with LRO error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ExportAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.exportAgent = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportAgent(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkExportAgentProgress without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExportAgentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportAgentProgress with error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkExportAgentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('importAgent', () => { - it('invokes importAgent without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ImportAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.importAgent = stubLongRunningCall(expectedResponse); - const [operation] = await client.importAgent(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.importAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes importAgent without error using callback', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ImportAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.importAgent = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importAgent( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.importAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes importAgent with call error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ImportAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.importAgent = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importAgent(request), expectedError); - assert((client.innerApiCalls.importAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes importAgent with LRO error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ImportAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.importAgent = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importAgent(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.importAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkImportAgentProgress without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkImportAgentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkImportAgentProgress with error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkImportAgentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('restoreAgent', () => { - it('invokes restoreAgent without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.RestoreAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.restoreAgent = stubLongRunningCall(expectedResponse); - const [operation] = await client.restoreAgent(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes restoreAgent without error using callback', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.RestoreAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.restoreAgent = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restoreAgent( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes restoreAgent with call error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.RestoreAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreAgent = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.restoreAgent(request), expectedError); - assert((client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes restoreAgent with LRO error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.RestoreAgentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreAgent = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.restoreAgent(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkRestoreAgentProgress without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRestoreAgentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRestoreAgentProgress with error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRestoreAgentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('searchAgents', () => { - it('invokes searchAgents without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), - ]; - client.innerApiCalls.searchAgents = stubSimpleCall(expectedResponse); - const [response] = await client.searchAgents(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.searchAgents as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes searchAgents without error using callback', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), - ]; - client.innerApiCalls.searchAgents = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchAgents( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IAgent[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.searchAgents as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes searchAgents with error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.searchAgents = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchAgents(request), expectedError); - assert((client.innerApiCalls.searchAgents as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes searchAgentsStream without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), - ]; - client.descriptors.page.searchAgents.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.searchAgentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.Agent[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Agent) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.searchAgents.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchAgents, request)); - assert.strictEqual( - (client.descriptors.page.searchAgents.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes searchAgentsStream with error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.searchAgents.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.searchAgentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.Agent[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Agent) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.searchAgents.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchAgents, request)); - assert.strictEqual( - (client.descriptors.page.searchAgents.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with searchAgents without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Agent()), - ]; - client.descriptors.page.searchAgents.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2beta1.IAgent[] = []; - const iterable = client.searchAgentsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.searchAgents.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.searchAgents.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with searchAgents with error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.searchAgents.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.searchAgentsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2beta1.IAgent[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.searchAgents.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.searchAgents.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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/owl-bot-staging/v2beta1/test/gapic_answer_records_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_answer_records_v2beta1.ts deleted file mode 100644 index 97205c85..00000000 --- a/owl-bot-staging/v2beta1/test/gapic_answer_records_v2beta1.ts +++ /dev/null @@ -1,2172 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as answerrecordsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2beta1.AnswerRecordsClient', () => { - it('has servicePath', () => { - const servicePath = answerrecordsModule.v2beta1.AnswerRecordsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = answerrecordsModule.v2beta1.AnswerRecordsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = answerrecordsModule.v2beta1.AnswerRecordsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.answerRecordsStub, undefined); - await client.initialize(); - assert(client.answerRecordsStub); - }); - - it('has close method', () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getAnswerRecord', () => { - it('invokes getAnswerRecord without error', async () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()); - client.innerApiCalls.getAnswerRecord = stubSimpleCall(expectedResponse); - const [response] = await client.getAnswerRecord(request); - assert(stub.calledOnce); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getAnswerRecord as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getAnswerRecord without error using callback', async () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()); - client.innerApiCalls.getAnswerRecord = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAnswerRecord( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IAnswerRecord|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert(stub.calledOnce); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getAnswerRecord as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getAnswerRecord with error', async () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getAnswerRecord = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAnswerRecord(request), expectedError); - assert(stub.calledOnce); - assert((client.innerApiCalls.getAnswerRecord as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateAnswerRecord', () => { - it('invokes updateAnswerRecord without error', async () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest()); - request.answerRecord = {}; - request.answerRecord.name = ''; - const expectedHeaderRequestParams = "answer_record.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()); - client.innerApiCalls.updateAnswerRecord = stubSimpleCall(expectedResponse); - const [response] = await client.updateAnswerRecord(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateAnswerRecord as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateAnswerRecord without error using callback', async () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest()); - request.answerRecord = {}; - request.answerRecord.name = ''; - const expectedHeaderRequestParams = "answer_record.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()); - client.innerApiCalls.updateAnswerRecord = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAnswerRecord( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IAnswerRecord|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateAnswerRecord as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateAnswerRecord with error', async () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest()); - request.answerRecord = {}; - request.answerRecord.name = ''; - const expectedHeaderRequestParams = "answer_record.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAnswerRecord = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateAnswerRecord(request), expectedError); - assert((client.innerApiCalls.updateAnswerRecord as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listAnswerRecords', () => { - it('invokes listAnswerRecords without error', async () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), - ]; - client.innerApiCalls.listAnswerRecords = stubSimpleCall(expectedResponse); - const [response] = await client.listAnswerRecords(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listAnswerRecords as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listAnswerRecords without error using callback', async () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), - ]; - client.innerApiCalls.listAnswerRecords = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAnswerRecords( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IAnswerRecord[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listAnswerRecords as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listAnswerRecords with error', async () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listAnswerRecords = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAnswerRecords(request), expectedError); - assert((client.innerApiCalls.listAnswerRecords as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listAnswerRecordsStream without error', async () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), - ]; - client.descriptors.page.listAnswerRecords.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAnswerRecordsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.AnswerRecord[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.AnswerRecord) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listAnswerRecords.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAnswerRecords, request)); - assert.strictEqual( - (client.descriptors.page.listAnswerRecords.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listAnswerRecordsStream with error', async () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listAnswerRecords.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAnswerRecordsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.AnswerRecord[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.AnswerRecord) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAnswerRecords.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAnswerRecords, request)); - assert.strictEqual( - (client.descriptors.page.listAnswerRecords.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listAnswerRecords without error', async () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnswerRecord()), - ]; - client.descriptors.page.listAnswerRecords.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2beta1.IAnswerRecord[] = []; - const iterable = client.listAnswerRecordsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listAnswerRecords with error', async () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listAnswerRecords.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAnswerRecordsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2beta1.IAnswerRecord[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - 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 answerrecordsModule.v2beta1.AnswerRecordsClient({ - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - 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 answerrecordsModule.v2beta1.AnswerRecordsClient({ - 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/owl-bot-staging/v2beta1/test/gapic_contexts_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_contexts_v2beta1.ts deleted file mode 100644 index 5f94afdb..00000000 --- a/owl-bot-staging/v2beta1/test/gapic_contexts_v2beta1.ts +++ /dev/null @@ -1,2456 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as contextsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2beta1.ContextsClient', () => { - it('has servicePath', () => { - const servicePath = contextsModule.v2beta1.ContextsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = contextsModule.v2beta1.ContextsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = contextsModule.v2beta1.ContextsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new contextsModule.v2beta1.ContextsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new contextsModule.v2beta1.ContextsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.contextsStub, undefined); - await client.initialize(); - assert(client.contextsStub); - }); - - it('has close method', () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getContext', () => { - it('invokes getContext without error', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetContextRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()); - client.innerApiCalls.getContext = stubSimpleCall(expectedResponse); - const [response] = await client.getContext(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getContext without error using callback', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetContextRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()); - client.innerApiCalls.getContext = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getContext( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IContext|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getContext with error', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetContextRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getContext = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getContext(request), expectedError); - assert((client.innerApiCalls.getContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createContext', () => { - it('invokes createContext without error', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateContextRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()); - client.innerApiCalls.createContext = stubSimpleCall(expectedResponse); - const [response] = await client.createContext(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createContext without error using callback', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateContextRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()); - client.innerApiCalls.createContext = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createContext( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IContext|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createContext with error', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateContextRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createContext = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createContext(request), expectedError); - assert((client.innerApiCalls.createContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateContext', () => { - it('invokes updateContext without error', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateContextRequest()); - request.context = {}; - request.context.name = ''; - const expectedHeaderRequestParams = "context.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()); - client.innerApiCalls.updateContext = stubSimpleCall(expectedResponse); - const [response] = await client.updateContext(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateContext without error using callback', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateContextRequest()); - request.context = {}; - request.context.name = ''; - const expectedHeaderRequestParams = "context.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()); - client.innerApiCalls.updateContext = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateContext( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IContext|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateContext with error', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateContextRequest()); - request.context = {}; - request.context.name = ''; - const expectedHeaderRequestParams = "context.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateContext = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateContext(request), expectedError); - assert((client.innerApiCalls.updateContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteContext', () => { - it('invokes deleteContext without error', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteContextRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteContext = stubSimpleCall(expectedResponse); - const [response] = await client.deleteContext(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteContext without error using callback', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteContextRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteContext = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteContext( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteContext with error', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteContextRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteContext = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteContext(request), expectedError); - assert((client.innerApiCalls.deleteContext as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteAllContexts', () => { - it('invokes deleteAllContexts without error', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteAllContexts = stubSimpleCall(expectedResponse); - const [response] = await client.deleteAllContexts(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteAllContexts as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteAllContexts without error using callback', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteAllContexts = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAllContexts( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteAllContexts as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteAllContexts with error', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAllContexts = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteAllContexts(request), expectedError); - assert((client.innerApiCalls.deleteAllContexts as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listContexts', () => { - it('invokes listContexts without error', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), - ]; - client.innerApiCalls.listContexts = stubSimpleCall(expectedResponse); - const [response] = await client.listContexts(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listContexts as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listContexts without error using callback', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), - ]; - client.innerApiCalls.listContexts = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listContexts( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IContext[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listContexts as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listContexts with error', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listContexts = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listContexts(request), expectedError); - assert((client.innerApiCalls.listContexts as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listContextsStream without error', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), - ]; - client.descriptors.page.listContexts.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listContextsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.Context[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Context) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listContexts.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listContexts, request)); - assert.strictEqual( - (client.descriptors.page.listContexts.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listContextsStream with error', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listContexts.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listContextsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.Context[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Context) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listContexts.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listContexts, request)); - assert.strictEqual( - (client.descriptors.page.listContexts.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listContexts without error', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Context()), - ]; - client.descriptors.page.listContexts.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2beta1.IContext[] = []; - const iterable = client.listContextsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listContexts.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listContexts.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listContexts with error', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listContexts.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listContextsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2beta1.IContext[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listContexts.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listContexts.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSession', () => { - const fakePath = "/rendered/path/projectAgentSession"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionPath', () => { - const result = client.projectAgentSessionPath("projectValue", "sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionName', () => { - const result = client.matchProjectFromProjectAgentSessionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionName', () => { - const result = client.matchSessionFromProjectAgentSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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/owl-bot-staging/v2beta1/test/gapic_conversation_profiles_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_conversation_profiles_v2beta1.ts deleted file mode 100644 index 11c53ea0..00000000 --- a/owl-bot-staging/v2beta1/test/gapic_conversation_profiles_v2beta1.ts +++ /dev/null @@ -1,2334 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as conversationprofilesModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2beta1.ConversationProfilesClient', () => { - it('has servicePath', () => { - const servicePath = conversationprofilesModule.v2beta1.ConversationProfilesClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = conversationprofilesModule.v2beta1.ConversationProfilesClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = conversationprofilesModule.v2beta1.ConversationProfilesClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.conversationProfilesStub, undefined); - await client.initialize(); - assert(client.conversationProfilesStub); - }); - - it('has close method', () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getConversationProfile', () => { - it('invokes getConversationProfile without error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()); - client.innerApiCalls.getConversationProfile = stubSimpleCall(expectedResponse); - const [response] = await client.getConversationProfile(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getConversationProfile without error using callback', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()); - client.innerApiCalls.getConversationProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getConversationProfile( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IConversationProfile|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getConversationProfile with error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getConversationProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConversationProfile(request), expectedError); - assert((client.innerApiCalls.getConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createConversationProfile', () => { - it('invokes createConversationProfile without error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()); - client.innerApiCalls.createConversationProfile = stubSimpleCall(expectedResponse); - const [response] = await client.createConversationProfile(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createConversationProfile without error using callback', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()); - client.innerApiCalls.createConversationProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createConversationProfile( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IConversationProfile|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createConversationProfile with error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createConversationProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createConversationProfile(request), expectedError); - assert((client.innerApiCalls.createConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateConversationProfile', () => { - it('invokes updateConversationProfile without error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest()); - request.conversationProfile = {}; - request.conversationProfile.name = ''; - const expectedHeaderRequestParams = "conversation_profile.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()); - client.innerApiCalls.updateConversationProfile = stubSimpleCall(expectedResponse); - const [response] = await client.updateConversationProfile(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateConversationProfile without error using callback', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest()); - request.conversationProfile = {}; - request.conversationProfile.name = ''; - const expectedHeaderRequestParams = "conversation_profile.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()); - client.innerApiCalls.updateConversationProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateConversationProfile( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IConversationProfile|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateConversationProfile with error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest()); - request.conversationProfile = {}; - request.conversationProfile.name = ''; - const expectedHeaderRequestParams = "conversation_profile.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateConversationProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateConversationProfile(request), expectedError); - assert((client.innerApiCalls.updateConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteConversationProfile', () => { - it('invokes deleteConversationProfile without error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteConversationProfile = stubSimpleCall(expectedResponse); - const [response] = await client.deleteConversationProfile(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteConversationProfile without error using callback', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteConversationProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteConversationProfile( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteConversationProfile with error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConversationProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteConversationProfile(request), expectedError); - assert((client.innerApiCalls.deleteConversationProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listConversationProfiles', () => { - it('invokes listConversationProfiles without error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), - ]; - client.innerApiCalls.listConversationProfiles = stubSimpleCall(expectedResponse); - const [response] = await client.listConversationProfiles(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listConversationProfiles as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listConversationProfiles without error using callback', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), - ]; - client.innerApiCalls.listConversationProfiles = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listConversationProfiles( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IConversationProfile[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listConversationProfiles as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listConversationProfiles with error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listConversationProfiles = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listConversationProfiles(request), expectedError); - assert((client.innerApiCalls.listConversationProfiles as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listConversationProfilesStream without error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), - ]; - client.descriptors.page.listConversationProfiles.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listConversationProfilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.ConversationProfile[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.ConversationProfile) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listConversationProfiles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConversationProfiles, request)); - assert.strictEqual( - (client.descriptors.page.listConversationProfiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listConversationProfilesStream with error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listConversationProfiles.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listConversationProfilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.ConversationProfile[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.ConversationProfile) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listConversationProfiles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConversationProfiles, request)); - assert.strictEqual( - (client.descriptors.page.listConversationProfiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listConversationProfiles without error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ConversationProfile()), - ]; - client.descriptors.page.listConversationProfiles.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2beta1.IConversationProfile[] = []; - const iterable = client.listConversationProfilesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listConversationProfiles with error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listConversationProfiles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listConversationProfilesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2beta1.IConversationProfile[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - 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 conversationprofilesModule.v2beta1.ConversationProfilesClient({ - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - 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 conversationprofilesModule.v2beta1.ConversationProfilesClient({ - 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/owl-bot-staging/v2beta1/test/gapic_conversations_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_conversations_v2beta1.ts deleted file mode 100644 index 6eaf8242..00000000 --- a/owl-bot-staging/v2beta1/test/gapic_conversations_v2beta1.ts +++ /dev/null @@ -1,2554 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as conversationsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2beta1.ConversationsClient', () => { - it('has servicePath', () => { - const servicePath = conversationsModule.v2beta1.ConversationsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = conversationsModule.v2beta1.ConversationsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = conversationsModule.v2beta1.ConversationsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new conversationsModule.v2beta1.ConversationsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.conversationsStub, undefined); - await client.initialize(); - assert(client.conversationsStub); - }); - - it('has close method', () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('createConversation', () => { - it('invokes createConversation without error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateConversationRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()); - client.innerApiCalls.createConversation = stubSimpleCall(expectedResponse); - const [response] = await client.createConversation(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createConversation without error using callback', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateConversationRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()); - client.innerApiCalls.createConversation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createConversation( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IConversation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createConversation with error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateConversationRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createConversation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createConversation(request), expectedError); - assert((client.innerApiCalls.createConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getConversation', () => { - it('invokes getConversation without error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetConversationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()); - client.innerApiCalls.getConversation = stubSimpleCall(expectedResponse); - const [response] = await client.getConversation(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getConversation without error using callback', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetConversationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()); - client.innerApiCalls.getConversation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getConversation( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IConversation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getConversation with error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetConversationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getConversation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConversation(request), expectedError); - assert((client.innerApiCalls.getConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('completeConversation', () => { - it('invokes completeConversation without error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CompleteConversationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()); - client.innerApiCalls.completeConversation = stubSimpleCall(expectedResponse); - const [response] = await client.completeConversation(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.completeConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes completeConversation without error using callback', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CompleteConversationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()); - client.innerApiCalls.completeConversation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.completeConversation( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IConversation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.completeConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes completeConversation with error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CompleteConversationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.completeConversation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.completeConversation(request), expectedError); - assert((client.innerApiCalls.completeConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('batchCreateMessages', () => { - it('invokes batchCreateMessages without error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse()); - client.innerApiCalls.batchCreateMessages = stubSimpleCall(expectedResponse); - const [response] = await client.batchCreateMessages(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchCreateMessages as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchCreateMessages without error using callback', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse()); - client.innerApiCalls.batchCreateMessages = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchCreateMessages( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchCreateMessages as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes batchCreateMessages with error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchCreateMessages = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.batchCreateMessages(request), expectedError); - assert((client.innerApiCalls.batchCreateMessages as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listConversations', () => { - it('invokes listConversations without error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), - ]; - client.innerApiCalls.listConversations = stubSimpleCall(expectedResponse); - const [response] = await client.listConversations(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listConversations as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listConversations without error using callback', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), - ]; - client.innerApiCalls.listConversations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listConversations( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IConversation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listConversations as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listConversations with error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listConversations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listConversations(request), expectedError); - assert((client.innerApiCalls.listConversations as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listConversationsStream without error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), - ]; - client.descriptors.page.listConversations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listConversationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.Conversation[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Conversation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listConversations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConversations, request)); - assert.strictEqual( - (client.descriptors.page.listConversations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listConversationsStream with error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listConversations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listConversationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.Conversation[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Conversation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listConversations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConversations, request)); - assert.strictEqual( - (client.descriptors.page.listConversations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listConversations without error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Conversation()), - ]; - client.descriptors.page.listConversations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2beta1.IConversation[] = []; - const iterable = client.listConversationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listConversations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listConversations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listConversations with error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listConversations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listConversationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2beta1.IConversation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listConversations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listConversations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listMessages', () => { - it('invokes listMessages without error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), - ]; - client.innerApiCalls.listMessages = stubSimpleCall(expectedResponse); - const [response] = await client.listMessages(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listMessages as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listMessages without error using callback', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), - ]; - client.innerApiCalls.listMessages = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMessages( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IMessage[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listMessages as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listMessages with error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listMessages = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMessages(request), expectedError); - assert((client.innerApiCalls.listMessages as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listMessagesStream without error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), - ]; - client.descriptors.page.listMessages.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMessagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.Message[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Message) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listMessages.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMessages, request)); - assert.strictEqual( - (client.descriptors.page.listMessages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listMessagesStream with error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listMessages.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMessagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.Message[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Message) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMessages.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMessages, request)); - assert.strictEqual( - (client.descriptors.page.listMessages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listMessages without error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Message()), - ]; - client.descriptors.page.listMessages.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2beta1.IMessage[] = []; - const iterable = client.listMessagesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMessages.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listMessages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listMessages with error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listMessages.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMessagesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2beta1.IMessage[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMessages.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listMessages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - 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 conversationsModule.v2beta1.ConversationsClient({ - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new conversationsModule.v2beta1.ConversationsClient({ - 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 conversationsModule.v2beta1.ConversationsClient({ - 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/owl-bot-staging/v2beta1/test/gapic_documents_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_documents_v2beta1.ts deleted file mode 100644 index 1b9a4f40..00000000 --- a/owl-bot-staging/v2beta1/test/gapic_documents_v2beta1.ts +++ /dev/null @@ -1,2819 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as documentsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2beta1.DocumentsClient', () => { - it('has servicePath', () => { - const servicePath = documentsModule.v2beta1.DocumentsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = documentsModule.v2beta1.DocumentsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = documentsModule.v2beta1.DocumentsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new documentsModule.v2beta1.DocumentsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.documentsStub, undefined); - await client.initialize(); - assert(client.documentsStub); - }); - - it('has close method', () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getDocument', () => { - it('invokes getDocument without error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()); - client.innerApiCalls.getDocument = stubSimpleCall(expectedResponse); - const [response] = await client.getDocument(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getDocument without error using callback', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()); - client.innerApiCalls.getDocument = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDocument( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IDocument|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getDocument with error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getDocument = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDocument(request), expectedError); - assert((client.innerApiCalls.getDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createDocument', () => { - it('invokes createDocument without error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateDocumentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createDocument = stubLongRunningCall(expectedResponse); - const [operation] = await client.createDocument(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createDocument without error using callback', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateDocumentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createDocument = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDocument( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createDocument with call error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateDocumentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createDocument = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createDocument(request), expectedError); - assert((client.innerApiCalls.createDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createDocument with LRO error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateDocumentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createDocument = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createDocument(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateDocumentProgress without error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateDocumentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateDocumentProgress with error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateDocumentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('importDocuments', () => { - it('invokes importDocuments without error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.importDocuments = stubLongRunningCall(expectedResponse); - const [operation] = await client.importDocuments(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.importDocuments as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes importDocuments without error using callback', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.importDocuments = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importDocuments( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.importDocuments as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes importDocuments with call error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.importDocuments = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importDocuments(request), expectedError); - assert((client.innerApiCalls.importDocuments as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes importDocuments with LRO error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.importDocuments = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importDocuments(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.importDocuments as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkImportDocumentsProgress without error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkImportDocumentsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkImportDocumentsProgress with error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkImportDocumentsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteDocument', () => { - it('invokes deleteDocument without error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteDocument = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteDocument(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteDocument without error using callback', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteDocument = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDocument( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteDocument with call error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDocument = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteDocument(request), expectedError); - assert((client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteDocument with LRO error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDocument = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteDocument(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeleteDocumentProgress without error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteDocumentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteDocumentProgress with error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteDocumentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateDocument', () => { - it('invokes updateDocument without error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest()); - request.document = {}; - request.document.name = ''; - const expectedHeaderRequestParams = "document.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateDocument = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateDocument(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateDocument without error using callback', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest()); - request.document = {}; - request.document.name = ''; - const expectedHeaderRequestParams = "document.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateDocument = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDocument( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateDocument with call error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest()); - request.document = {}; - request.document.name = ''; - const expectedHeaderRequestParams = "document.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDocument = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateDocument(request), expectedError); - assert((client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateDocument with LRO error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest()); - request.document = {}; - request.document.name = ''; - const expectedHeaderRequestParams = "document.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDocument = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateDocument(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateDocumentProgress without error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateDocumentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateDocumentProgress with error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateDocumentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('reloadDocument', () => { - it('invokes reloadDocument without error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.reloadDocument = stubLongRunningCall(expectedResponse); - const [operation] = await client.reloadDocument(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes reloadDocument without error using callback', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.reloadDocument = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.reloadDocument( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes reloadDocument with call error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.reloadDocument = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.reloadDocument(request), expectedError); - assert((client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes reloadDocument with LRO error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.reloadDocument = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.reloadDocument(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkReloadDocumentProgress without error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkReloadDocumentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkReloadDocumentProgress with error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkReloadDocumentProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listDocuments', () => { - it('invokes listDocuments without error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), - ]; - client.innerApiCalls.listDocuments = stubSimpleCall(expectedResponse); - const [response] = await client.listDocuments(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listDocuments as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listDocuments without error using callback', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), - ]; - client.innerApiCalls.listDocuments = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDocuments( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IDocument[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listDocuments as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listDocuments with error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listDocuments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDocuments(request), expectedError); - assert((client.innerApiCalls.listDocuments as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listDocumentsStream without error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), - ]; - client.descriptors.page.listDocuments.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDocumentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.Document[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Document) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listDocuments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDocuments, request)); - assert.strictEqual( - (client.descriptors.page.listDocuments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listDocumentsStream with error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listDocuments.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDocumentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.Document[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Document) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDocuments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDocuments, request)); - assert.strictEqual( - (client.descriptors.page.listDocuments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listDocuments without error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Document()), - ]; - client.descriptors.page.listDocuments.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2beta1.IDocument[] = []; - const iterable = client.listDocumentsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDocuments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listDocuments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listDocuments with error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listDocuments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDocumentsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2beta1.IDocument[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDocuments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listDocuments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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/owl-bot-staging/v2beta1/test/gapic_entity_types_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_entity_types_v2beta1.ts deleted file mode 100644 index cce78f0a..00000000 --- a/owl-bot-staging/v2beta1/test/gapic_entity_types_v2beta1.ts +++ /dev/null @@ -1,3070 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as entitytypesModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2beta1.EntityTypesClient', () => { - it('has servicePath', () => { - const servicePath = entitytypesModule.v2beta1.EntityTypesClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = entitytypesModule.v2beta1.EntityTypesClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = entitytypesModule.v2beta1.EntityTypesClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.entityTypesStub, undefined); - await client.initialize(); - assert(client.entityTypesStub); - }); - - it('has close method', () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getEntityType', () => { - it('invokes getEntityType without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()); - client.innerApiCalls.getEntityType = stubSimpleCall(expectedResponse); - const [response] = await client.getEntityType(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getEntityType without error using callback', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()); - client.innerApiCalls.getEntityType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getEntityType( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IEntityType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getEntityType with error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEntityType(request), expectedError); - assert((client.innerApiCalls.getEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createEntityType', () => { - it('invokes createEntityType without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()); - client.innerApiCalls.createEntityType = stubSimpleCall(expectedResponse); - const [response] = await client.createEntityType(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createEntityType without error using callback', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()); - client.innerApiCalls.createEntityType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createEntityType( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IEntityType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createEntityType with error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createEntityType(request), expectedError); - assert((client.innerApiCalls.createEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateEntityType', () => { - it('invokes updateEntityType without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest()); - request.entityType = {}; - request.entityType.name = ''; - const expectedHeaderRequestParams = "entity_type.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()); - client.innerApiCalls.updateEntityType = stubSimpleCall(expectedResponse); - const [response] = await client.updateEntityType(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateEntityType without error using callback', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest()); - request.entityType = {}; - request.entityType.name = ''; - const expectedHeaderRequestParams = "entity_type.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()); - client.innerApiCalls.updateEntityType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateEntityType( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IEntityType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateEntityType with error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest()); - request.entityType = {}; - request.entityType.name = ''; - const expectedHeaderRequestParams = "entity_type.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateEntityType(request), expectedError); - assert((client.innerApiCalls.updateEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteEntityType', () => { - it('invokes deleteEntityType without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteEntityType = stubSimpleCall(expectedResponse); - const [response] = await client.deleteEntityType(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteEntityType without error using callback', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteEntityType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteEntityType( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteEntityType with error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteEntityType(request), expectedError); - assert((client.innerApiCalls.deleteEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('batchUpdateEntityTypes', () => { - it('invokes batchUpdateEntityTypes without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall(expectedResponse); - const [operation] = await client.batchUpdateEntityTypes(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchUpdateEntityTypes without error using callback', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchUpdateEntityTypes( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes batchUpdateEntityTypes with call error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchUpdateEntityTypes(request), expectedError); - assert((client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchUpdateEntityTypes with LRO error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchUpdateEntityTypes(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkBatchUpdateEntityTypesProgress without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkBatchUpdateEntityTypesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBatchUpdateEntityTypesProgress with error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkBatchUpdateEntityTypesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('batchDeleteEntityTypes', () => { - it('invokes batchDeleteEntityTypes without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall(expectedResponse); - const [operation] = await client.batchDeleteEntityTypes(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchDeleteEntityTypes without error using callback', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchDeleteEntityTypes( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes batchDeleteEntityTypes with call error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchDeleteEntityTypes(request), expectedError); - assert((client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchDeleteEntityTypes with LRO error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchDeleteEntityTypes(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkBatchDeleteEntityTypesProgress without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkBatchDeleteEntityTypesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBatchDeleteEntityTypesProgress with error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkBatchDeleteEntityTypesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('batchCreateEntities', () => { - it('invokes batchCreateEntities without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchCreateEntities = stubLongRunningCall(expectedResponse); - const [operation] = await client.batchCreateEntities(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchCreateEntities without error using callback', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchCreateEntities = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchCreateEntities( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes batchCreateEntities with call error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchCreateEntities = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchCreateEntities(request), expectedError); - assert((client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchCreateEntities with LRO error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchCreateEntities = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchCreateEntities(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkBatchCreateEntitiesProgress without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkBatchCreateEntitiesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBatchCreateEntitiesProgress with error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkBatchCreateEntitiesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('batchUpdateEntities', () => { - it('invokes batchUpdateEntities without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchUpdateEntities = stubLongRunningCall(expectedResponse); - const [operation] = await client.batchUpdateEntities(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchUpdateEntities without error using callback', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchUpdateEntities = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchUpdateEntities( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes batchUpdateEntities with call error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateEntities = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchUpdateEntities(request), expectedError); - assert((client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchUpdateEntities with LRO error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateEntities = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchUpdateEntities(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkBatchUpdateEntitiesProgress without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkBatchUpdateEntitiesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBatchUpdateEntitiesProgress with error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkBatchUpdateEntitiesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('batchDeleteEntities', () => { - it('invokes batchDeleteEntities without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchDeleteEntities = stubLongRunningCall(expectedResponse); - const [operation] = await client.batchDeleteEntities(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchDeleteEntities without error using callback', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchDeleteEntities = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchDeleteEntities( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes batchDeleteEntities with call error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteEntities = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchDeleteEntities(request), expectedError); - assert((client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchDeleteEntities with LRO error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteEntities = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchDeleteEntities(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkBatchDeleteEntitiesProgress without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkBatchDeleteEntitiesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBatchDeleteEntitiesProgress with error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkBatchDeleteEntitiesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listEntityTypes', () => { - it('invokes listEntityTypes without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), - ]; - client.innerApiCalls.listEntityTypes = stubSimpleCall(expectedResponse); - const [response] = await client.listEntityTypes(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listEntityTypes without error using callback', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), - ]; - client.innerApiCalls.listEntityTypes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listEntityTypes( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IEntityType[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listEntityTypes with error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listEntityTypes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listEntityTypes(request), expectedError); - assert((client.innerApiCalls.listEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listEntityTypesStream without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), - ]; - client.descriptors.page.listEntityTypes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listEntityTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.EntityType[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.EntityType) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listEntityTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listEntityTypes, request)); - assert.strictEqual( - (client.descriptors.page.listEntityTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listEntityTypesStream with error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listEntityTypes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listEntityTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.EntityType[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.EntityType) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listEntityTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listEntityTypes, request)); - assert.strictEqual( - (client.descriptors.page.listEntityTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listEntityTypes without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EntityType()), - ]; - client.descriptors.page.listEntityTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2beta1.IEntityType[] = []; - const iterable = client.listEntityTypesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listEntityTypes with error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listEntityTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listEntityTypesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2beta1.IEntityType[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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/owl-bot-staging/v2beta1/test/gapic_environments_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_environments_v2beta1.ts deleted file mode 100644 index f202bbf9..00000000 --- a/owl-bot-staging/v2beta1/test/gapic_environments_v2beta1.ts +++ /dev/null @@ -1,2557 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as environmentsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2beta1.EnvironmentsClient', () => { - it('has servicePath', () => { - const servicePath = environmentsModule.v2beta1.EnvironmentsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = environmentsModule.v2beta1.EnvironmentsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = environmentsModule.v2beta1.EnvironmentsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.environmentsStub, undefined); - await client.initialize(); - assert(client.environmentsStub); - }); - - it('has close method', () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getEnvironment', () => { - it('invokes getEnvironment without error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()); - client.innerApiCalls.getEnvironment = stubSimpleCall(expectedResponse); - const [response] = await client.getEnvironment(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getEnvironment without error using callback', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()); - client.innerApiCalls.getEnvironment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getEnvironment( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IEnvironment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getEnvironment with error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getEnvironment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEnvironment(request), expectedError); - assert((client.innerApiCalls.getEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createEnvironment', () => { - it('invokes createEnvironment without error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()); - client.innerApiCalls.createEnvironment = stubSimpleCall(expectedResponse); - const [response] = await client.createEnvironment(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createEnvironment without error using callback', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()); - client.innerApiCalls.createEnvironment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createEnvironment( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IEnvironment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createEnvironment with error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createEnvironment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createEnvironment(request), expectedError); - assert((client.innerApiCalls.createEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateEnvironment', () => { - it('invokes updateEnvironment without error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest()); - request.environment = {}; - request.environment.name = ''; - const expectedHeaderRequestParams = "environment.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()); - client.innerApiCalls.updateEnvironment = stubSimpleCall(expectedResponse); - const [response] = await client.updateEnvironment(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateEnvironment without error using callback', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest()); - request.environment = {}; - request.environment.name = ''; - const expectedHeaderRequestParams = "environment.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()); - client.innerApiCalls.updateEnvironment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateEnvironment( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IEnvironment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateEnvironment with error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest()); - request.environment = {}; - request.environment.name = ''; - const expectedHeaderRequestParams = "environment.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateEnvironment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateEnvironment(request), expectedError); - assert((client.innerApiCalls.updateEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteEnvironment', () => { - it('invokes deleteEnvironment without error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteEnvironment = stubSimpleCall(expectedResponse); - const [response] = await client.deleteEnvironment(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteEnvironment without error using callback', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteEnvironment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteEnvironment( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteEnvironment with error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteEnvironment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteEnvironment(request), expectedError); - assert((client.innerApiCalls.deleteEnvironment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listEnvironments', () => { - it('invokes listEnvironments without error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), - ]; - client.innerApiCalls.listEnvironments = stubSimpleCall(expectedResponse); - const [response] = await client.listEnvironments(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listEnvironments as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listEnvironments without error using callback', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), - ]; - client.innerApiCalls.listEnvironments = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listEnvironments( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IEnvironment[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listEnvironments as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listEnvironments with error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listEnvironments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listEnvironments(request), expectedError); - assert((client.innerApiCalls.listEnvironments as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listEnvironmentsStream without error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), - ]; - client.descriptors.page.listEnvironments.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listEnvironmentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.Environment[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Environment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listEnvironments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listEnvironments, request)); - assert.strictEqual( - (client.descriptors.page.listEnvironments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listEnvironmentsStream with error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listEnvironments.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listEnvironmentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.Environment[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Environment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listEnvironments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listEnvironments, request)); - assert.strictEqual( - (client.descriptors.page.listEnvironments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listEnvironments without error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Environment()), - ]; - client.descriptors.page.listEnvironments.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2beta1.IEnvironment[] = []; - const iterable = client.listEnvironmentsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listEnvironments with error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listEnvironments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listEnvironmentsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2beta1.IEnvironment[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('getEnvironmentHistory', () => { - it('invokes getEnvironmentHistory without error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), - ]; - client.innerApiCalls.getEnvironmentHistory = stubSimpleCall(expectedResponse); - const [response] = await client.getEnvironmentHistory(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getEnvironmentHistory as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getEnvironmentHistory without error using callback', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), - ]; - client.innerApiCalls.getEnvironmentHistory = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getEnvironmentHistory( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getEnvironmentHistory as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getEnvironmentHistory with error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getEnvironmentHistory = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEnvironmentHistory(request), expectedError); - assert((client.innerApiCalls.getEnvironmentHistory as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getEnvironmentHistoryStream without error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), - ]; - client.descriptors.page.getEnvironmentHistory.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.getEnvironmentHistoryStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.getEnvironmentHistory, request)); - assert.strictEqual( - (client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes getEnvironmentHistoryStream with error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.getEnvironmentHistory.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.getEnvironmentHistoryStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.getEnvironmentHistory, request)); - assert.strictEqual( - (client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with getEnvironmentHistory without error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry()), - ]; - client.descriptors.page.getEnvironmentHistory.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry[] = []; - const iterable = client.getEnvironmentHistoryAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with getEnvironmentHistory with error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.getEnvironmentHistory.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.getEnvironmentHistoryAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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/owl-bot-staging/v2beta1/test/gapic_fulfillments_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_fulfillments_v2beta1.ts deleted file mode 100644 index bbbd0052..00000000 --- a/owl-bot-staging/v2beta1/test/gapic_fulfillments_v2beta1.ts +++ /dev/null @@ -1,1866 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as fulfillmentsModule from '../src'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v2beta1.FulfillmentsClient', () => { - it('has servicePath', () => { - const servicePath = fulfillmentsModule.v2beta1.FulfillmentsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = fulfillmentsModule.v2beta1.FulfillmentsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = fulfillmentsModule.v2beta1.FulfillmentsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.fulfillmentsStub, undefined); - await client.initialize(); - assert(client.fulfillmentsStub); - }); - - it('has close method', () => { - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getFulfillment', () => { - it('invokes getFulfillment without error', async () => { - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Fulfillment()); - client.innerApiCalls.getFulfillment = stubSimpleCall(expectedResponse); - const [response] = await client.getFulfillment(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getFulfillment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getFulfillment without error using callback', async () => { - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Fulfillment()); - client.innerApiCalls.getFulfillment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFulfillment( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IFulfillment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getFulfillment as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getFulfillment with error', async () => { - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getFulfillment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFulfillment(request), expectedError); - assert((client.innerApiCalls.getFulfillment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateFulfillment', () => { - it('invokes updateFulfillment without error', async () => { - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest()); - request.fulfillment = {}; - request.fulfillment.name = ''; - const expectedHeaderRequestParams = "fulfillment.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Fulfillment()); - client.innerApiCalls.updateFulfillment = stubSimpleCall(expectedResponse); - const [response] = await client.updateFulfillment(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateFulfillment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateFulfillment without error using callback', async () => { - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest()); - request.fulfillment = {}; - request.fulfillment.name = ''; - const expectedHeaderRequestParams = "fulfillment.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Fulfillment()); - client.innerApiCalls.updateFulfillment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFulfillment( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IFulfillment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateFulfillment as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateFulfillment with error', async () => { - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest()); - request.fulfillment = {}; - request.fulfillment.name = ''; - const expectedHeaderRequestParams = "fulfillment.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFulfillment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateFulfillment(request), expectedError); - assert((client.innerApiCalls.updateFulfillment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('Path templates', () => { - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - 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 fulfillmentsModule.v2beta1.FulfillmentsClient({ - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - 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 fulfillmentsModule.v2beta1.FulfillmentsClient({ - 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/owl-bot-staging/v2beta1/test/gapic_intents_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_intents_v2beta1.ts deleted file mode 100644 index f35e2f58..00000000 --- a/owl-bot-staging/v2beta1/test/gapic_intents_v2beta1.ts +++ /dev/null @@ -1,2638 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as intentsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2beta1.IntentsClient', () => { - it('has servicePath', () => { - const servicePath = intentsModule.v2beta1.IntentsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = intentsModule.v2beta1.IntentsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = intentsModule.v2beta1.IntentsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new intentsModule.v2beta1.IntentsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new intentsModule.v2beta1.IntentsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.intentsStub, undefined); - await client.initialize(); - assert(client.intentsStub); - }); - - it('has close method', () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getIntent', () => { - it('invokes getIntent without error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetIntentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()); - client.innerApiCalls.getIntent = stubSimpleCall(expectedResponse); - const [response] = await client.getIntent(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getIntent without error using callback', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetIntentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()); - client.innerApiCalls.getIntent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIntent( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IIntent|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getIntent with error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetIntentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getIntent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIntent(request), expectedError); - assert((client.innerApiCalls.getIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createIntent', () => { - it('invokes createIntent without error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateIntentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()); - client.innerApiCalls.createIntent = stubSimpleCall(expectedResponse); - const [response] = await client.createIntent(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createIntent without error using callback', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateIntentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()); - client.innerApiCalls.createIntent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createIntent( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IIntent|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createIntent with error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateIntentRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createIntent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createIntent(request), expectedError); - assert((client.innerApiCalls.createIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateIntent', () => { - it('invokes updateIntent without error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateIntentRequest()); - request.intent = {}; - request.intent.name = ''; - const expectedHeaderRequestParams = "intent.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()); - client.innerApiCalls.updateIntent = stubSimpleCall(expectedResponse); - const [response] = await client.updateIntent(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateIntent without error using callback', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateIntentRequest()); - request.intent = {}; - request.intent.name = ''; - const expectedHeaderRequestParams = "intent.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()); - client.innerApiCalls.updateIntent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateIntent( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IIntent|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateIntent with error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateIntentRequest()); - request.intent = {}; - request.intent.name = ''; - const expectedHeaderRequestParams = "intent.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateIntent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateIntent(request), expectedError); - assert((client.innerApiCalls.updateIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteIntent', () => { - it('invokes deleteIntent without error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteIntentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteIntent = stubSimpleCall(expectedResponse); - const [response] = await client.deleteIntent(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteIntent without error using callback', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteIntentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteIntent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteIntent( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteIntent with error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteIntentRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteIntent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteIntent(request), expectedError); - assert((client.innerApiCalls.deleteIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('batchUpdateIntents', () => { - it('invokes batchUpdateIntents without error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchUpdateIntents = stubLongRunningCall(expectedResponse); - const [operation] = await client.batchUpdateIntents(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchUpdateIntents without error using callback', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchUpdateIntents = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchUpdateIntents( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes batchUpdateIntents with call error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateIntents = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchUpdateIntents(request), expectedError); - assert((client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchUpdateIntents with LRO error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateIntents = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchUpdateIntents(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkBatchUpdateIntentsProgress without error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkBatchUpdateIntentsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBatchUpdateIntentsProgress with error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkBatchUpdateIntentsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('batchDeleteIntents', () => { - it('invokes batchDeleteIntents without error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchDeleteIntents = stubLongRunningCall(expectedResponse); - const [operation] = await client.batchDeleteIntents(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchDeleteIntents without error using callback', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.batchDeleteIntents = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchDeleteIntents( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes batchDeleteIntents with call error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteIntents = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchDeleteIntents(request), expectedError); - assert((client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes batchDeleteIntents with LRO error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteIntents = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchDeleteIntents(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkBatchDeleteIntentsProgress without error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkBatchDeleteIntentsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBatchDeleteIntentsProgress with error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkBatchDeleteIntentsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listIntents', () => { - it('invokes listIntents without error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), - ]; - client.innerApiCalls.listIntents = stubSimpleCall(expectedResponse); - const [response] = await client.listIntents(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listIntents without error using callback', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), - ]; - client.innerApiCalls.listIntents = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listIntents( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IIntent[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listIntents with error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listIntents = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listIntents(request), expectedError); - assert((client.innerApiCalls.listIntents as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listIntentsStream without error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), - ]; - client.descriptors.page.listIntents.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listIntentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.Intent[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Intent) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listIntents.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listIntents, request)); - assert.strictEqual( - (client.descriptors.page.listIntents.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listIntentsStream with error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listIntents.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listIntentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.Intent[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Intent) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listIntents.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listIntents, request)); - assert.strictEqual( - (client.descriptors.page.listIntents.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listIntents without error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Intent()), - ]; - client.descriptors.page.listIntents.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2beta1.IIntent[] = []; - const iterable = client.listIntentsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listIntents.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listIntents.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listIntents with error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listIntents.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listIntentsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2beta1.IIntent[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listIntents.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listIntents.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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/owl-bot-staging/v2beta1/test/gapic_knowledge_bases_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_knowledge_bases_v2beta1.ts deleted file mode 100644 index 1756d92f..00000000 --- a/owl-bot-staging/v2beta1/test/gapic_knowledge_bases_v2beta1.ts +++ /dev/null @@ -1,2334 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as knowledgebasesModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2beta1.KnowledgeBasesClient', () => { - it('has servicePath', () => { - const servicePath = knowledgebasesModule.v2beta1.KnowledgeBasesClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = knowledgebasesModule.v2beta1.KnowledgeBasesClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = knowledgebasesModule.v2beta1.KnowledgeBasesClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.knowledgeBasesStub, undefined); - await client.initialize(); - assert(client.knowledgeBasesStub); - }); - - it('has close method', () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getKnowledgeBase', () => { - it('invokes getKnowledgeBase without error', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()); - client.innerApiCalls.getKnowledgeBase = stubSimpleCall(expectedResponse); - const [response] = await client.getKnowledgeBase(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getKnowledgeBase without error using callback', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()); - client.innerApiCalls.getKnowledgeBase = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getKnowledgeBase( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getKnowledgeBase with error', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getKnowledgeBase = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getKnowledgeBase(request), expectedError); - assert((client.innerApiCalls.getKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createKnowledgeBase', () => { - it('invokes createKnowledgeBase without error', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()); - client.innerApiCalls.createKnowledgeBase = stubSimpleCall(expectedResponse); - const [response] = await client.createKnowledgeBase(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createKnowledgeBase without error using callback', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()); - client.innerApiCalls.createKnowledgeBase = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createKnowledgeBase( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createKnowledgeBase with error', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createKnowledgeBase = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createKnowledgeBase(request), expectedError); - assert((client.innerApiCalls.createKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteKnowledgeBase', () => { - it('invokes deleteKnowledgeBase without error', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteKnowledgeBase = stubSimpleCall(expectedResponse); - const [response] = await client.deleteKnowledgeBase(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteKnowledgeBase without error using callback', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteKnowledgeBase = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteKnowledgeBase( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteKnowledgeBase with error', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteKnowledgeBase = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteKnowledgeBase(request), expectedError); - assert((client.innerApiCalls.deleteKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateKnowledgeBase', () => { - it('invokes updateKnowledgeBase without error', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest()); - request.knowledgeBase = {}; - request.knowledgeBase.name = ''; - const expectedHeaderRequestParams = "knowledge_base.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()); - client.innerApiCalls.updateKnowledgeBase = stubSimpleCall(expectedResponse); - const [response] = await client.updateKnowledgeBase(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateKnowledgeBase without error using callback', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest()); - request.knowledgeBase = {}; - request.knowledgeBase.name = ''; - const expectedHeaderRequestParams = "knowledge_base.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()); - client.innerApiCalls.updateKnowledgeBase = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateKnowledgeBase( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateKnowledgeBase with error', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest()); - request.knowledgeBase = {}; - request.knowledgeBase.name = ''; - const expectedHeaderRequestParams = "knowledge_base.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateKnowledgeBase = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateKnowledgeBase(request), expectedError); - assert((client.innerApiCalls.updateKnowledgeBase as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listKnowledgeBases', () => { - it('invokes listKnowledgeBases without error', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), - ]; - client.innerApiCalls.listKnowledgeBases = stubSimpleCall(expectedResponse); - const [response] = await client.listKnowledgeBases(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listKnowledgeBases as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listKnowledgeBases without error using callback', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), - ]; - client.innerApiCalls.listKnowledgeBases = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listKnowledgeBases( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listKnowledgeBases as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listKnowledgeBases with error', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listKnowledgeBases = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listKnowledgeBases(request), expectedError); - assert((client.innerApiCalls.listKnowledgeBases as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listKnowledgeBasesStream without error', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), - ]; - client.descriptors.page.listKnowledgeBases.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listKnowledgeBasesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.KnowledgeBase[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.KnowledgeBase) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listKnowledgeBases.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listKnowledgeBases, request)); - assert.strictEqual( - (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listKnowledgeBasesStream with error', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listKnowledgeBases.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listKnowledgeBasesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.KnowledgeBase[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.KnowledgeBase) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listKnowledgeBases.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listKnowledgeBases, request)); - assert.strictEqual( - (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listKnowledgeBases without error', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase()), - ]; - client.descriptors.page.listKnowledgeBases.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase[] = []; - const iterable = client.listKnowledgeBasesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listKnowledgeBases with error', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listKnowledgeBases.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listKnowledgeBasesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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/owl-bot-staging/v2beta1/test/gapic_participants_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_participants_v2beta1.ts deleted file mode 100644 index 622f0163..00000000 --- a/owl-bot-staging/v2beta1/test/gapic_participants_v2beta1.ts +++ /dev/null @@ -1,2913 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as participantsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2beta1.ParticipantsClient', () => { - it('has servicePath', () => { - const servicePath = participantsModule.v2beta1.ParticipantsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = participantsModule.v2beta1.ParticipantsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = participantsModule.v2beta1.ParticipantsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new participantsModule.v2beta1.ParticipantsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.participantsStub, undefined); - await client.initialize(); - assert(client.participantsStub); - }); - - it('has close method', () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('createParticipant', () => { - it('invokes createParticipant without error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateParticipantRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()); - client.innerApiCalls.createParticipant = stubSimpleCall(expectedResponse); - const [response] = await client.createParticipant(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createParticipant as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createParticipant without error using callback', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateParticipantRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()); - client.innerApiCalls.createParticipant = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createParticipant( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IParticipant|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createParticipant as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createParticipant with error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateParticipantRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createParticipant = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createParticipant(request), expectedError); - assert((client.innerApiCalls.createParticipant as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getParticipant', () => { - it('invokes getParticipant without error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetParticipantRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()); - client.innerApiCalls.getParticipant = stubSimpleCall(expectedResponse); - const [response] = await client.getParticipant(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getParticipant as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getParticipant without error using callback', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetParticipantRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()); - client.innerApiCalls.getParticipant = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getParticipant( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IParticipant|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getParticipant as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getParticipant with error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetParticipantRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getParticipant = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getParticipant(request), expectedError); - assert((client.innerApiCalls.getParticipant as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateParticipant', () => { - it('invokes updateParticipant without error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest()); - request.participant = {}; - request.participant.name = ''; - const expectedHeaderRequestParams = "participant.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()); - client.innerApiCalls.updateParticipant = stubSimpleCall(expectedResponse); - const [response] = await client.updateParticipant(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateParticipant as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateParticipant without error using callback', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest()); - request.participant = {}; - request.participant.name = ''; - const expectedHeaderRequestParams = "participant.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()); - client.innerApiCalls.updateParticipant = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateParticipant( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IParticipant|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateParticipant as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateParticipant with error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest()); - request.participant = {}; - request.participant.name = ''; - const expectedHeaderRequestParams = "participant.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateParticipant = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateParticipant(request), expectedError); - assert((client.innerApiCalls.updateParticipant as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('analyzeContent', () => { - it('invokes analyzeContent without error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest()); - request.participant = ''; - const expectedHeaderRequestParams = "participant="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnalyzeContentResponse()); - client.innerApiCalls.analyzeContent = stubSimpleCall(expectedResponse); - const [response] = await client.analyzeContent(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.analyzeContent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes analyzeContent without error using callback', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest()); - request.participant = ''; - const expectedHeaderRequestParams = "participant="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnalyzeContentResponse()); - client.innerApiCalls.analyzeContent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.analyzeContent( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.analyzeContent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes analyzeContent with error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest()); - request.participant = ''; - const expectedHeaderRequestParams = "participant="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeContent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.analyzeContent(request), expectedError); - assert((client.innerApiCalls.analyzeContent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('suggestArticles', () => { - it('invokes suggestArticles without error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestArticlesResponse()); - client.innerApiCalls.suggestArticles = stubSimpleCall(expectedResponse); - const [response] = await client.suggestArticles(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.suggestArticles as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes suggestArticles without error using callback', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestArticlesResponse()); - client.innerApiCalls.suggestArticles = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.suggestArticles( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.suggestArticles as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes suggestArticles with error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.suggestArticles = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.suggestArticles(request), expectedError); - assert((client.innerApiCalls.suggestArticles as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('suggestFaqAnswers', () => { - it('invokes suggestFaqAnswers without error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse()); - client.innerApiCalls.suggestFaqAnswers = stubSimpleCall(expectedResponse); - const [response] = await client.suggestFaqAnswers(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.suggestFaqAnswers as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes suggestFaqAnswers without error using callback', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse()); - client.innerApiCalls.suggestFaqAnswers = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.suggestFaqAnswers( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.suggestFaqAnswers as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes suggestFaqAnswers with error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.suggestFaqAnswers = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.suggestFaqAnswers(request), expectedError); - assert((client.innerApiCalls.suggestFaqAnswers as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('suggestSmartReplies', () => { - it('invokes suggestSmartReplies without error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse()); - client.innerApiCalls.suggestSmartReplies = stubSimpleCall(expectedResponse); - const [response] = await client.suggestSmartReplies(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.suggestSmartReplies as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes suggestSmartReplies without error using callback', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse()); - client.innerApiCalls.suggestSmartReplies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.suggestSmartReplies( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.suggestSmartReplies as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes suggestSmartReplies with error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.suggestSmartReplies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.suggestSmartReplies(request), expectedError); - assert((client.innerApiCalls.suggestSmartReplies as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('compileSuggestion', () => { - it('invokes compileSuggestion without error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CompileSuggestionResponse()); - client.innerApiCalls.compileSuggestion = stubSimpleCall(expectedResponse); - const [response] = await client.compileSuggestion(request); - assert(stub.calledOnce); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.compileSuggestion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes compileSuggestion without error using callback', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CompileSuggestionResponse()); - client.innerApiCalls.compileSuggestion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.compileSuggestion( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert(stub.calledOnce); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.compileSuggestion as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes compileSuggestion with error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.compileSuggestion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.compileSuggestion(request), expectedError); - assert(stub.calledOnce); - assert((client.innerApiCalls.compileSuggestion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listParticipants', () => { - it('invokes listParticipants without error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), - ]; - client.innerApiCalls.listParticipants = stubSimpleCall(expectedResponse); - const [response] = await client.listParticipants(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listParticipants as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listParticipants without error using callback', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), - ]; - client.innerApiCalls.listParticipants = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listParticipants( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IParticipant[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listParticipants as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listParticipants with error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listParticipants = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listParticipants(request), expectedError); - assert((client.innerApiCalls.listParticipants as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listParticipantsStream without error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), - ]; - client.descriptors.page.listParticipants.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listParticipantsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.Participant[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Participant) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listParticipants.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listParticipants, request)); - assert.strictEqual( - (client.descriptors.page.listParticipants.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listParticipantsStream with error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listParticipants.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listParticipantsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.Participant[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Participant) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listParticipants.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listParticipants, request)); - assert.strictEqual( - (client.descriptors.page.listParticipants.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listParticipants without error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Participant()), - ]; - client.descriptors.page.listParticipants.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2beta1.IParticipant[] = []; - const iterable = client.listParticipantsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listParticipants.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listParticipants.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listParticipants with error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listParticipants.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listParticipantsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2beta1.IParticipant[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listParticipants.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listParticipants.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listSuggestions', () => { - it('invokes listSuggestions without error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), - ]; - client.innerApiCalls.listSuggestions = stubSimpleCall(expectedResponse); - const [response] = await client.listSuggestions(request); - assert(stub.calledOnce); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSuggestions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSuggestions without error using callback', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), - ]; - client.innerApiCalls.listSuggestions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSuggestions( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.ISuggestion[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert(stub.calledOnce); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSuggestions as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listSuggestions with error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listSuggestions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSuggestions(request), expectedError); - assert(stub.calledOnce); - assert((client.innerApiCalls.listSuggestions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSuggestionsStream without error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), - ]; - client.descriptors.page.listSuggestions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSuggestionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.Suggestion[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Suggestion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert(stub.calledOnce); - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSuggestions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSuggestions, request)); - assert.strictEqual( - (client.descriptors.page.listSuggestions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listSuggestionsStream with error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listSuggestions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSuggestionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.Suggestion[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Suggestion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert(stub.calledOnce); - assert((client.descriptors.page.listSuggestions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSuggestions, request)); - assert.strictEqual( - (client.descriptors.page.listSuggestions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSuggestions without error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Suggestion()), - ]; - client.descriptors.page.listSuggestions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2beta1.ISuggestion[] = []; - const iterable = client.listSuggestionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert(stub.calledOnce); - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSuggestions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSuggestions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSuggestions with error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listSuggestions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSuggestionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2beta1.ISuggestion[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert(stub.calledOnce); - assert.deepStrictEqual( - (client.descriptors.page.listSuggestions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSuggestions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - 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 participantsModule.v2beta1.ParticipantsClient({ - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new participantsModule.v2beta1.ParticipantsClient({ - 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 participantsModule.v2beta1.ParticipantsClient({ - 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/owl-bot-staging/v2beta1/test/gapic_session_entity_types_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_session_entity_types_v2beta1.ts deleted file mode 100644 index 7979c6b0..00000000 --- a/owl-bot-staging/v2beta1/test/gapic_session_entity_types_v2beta1.ts +++ /dev/null @@ -1,2372 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as sessionentitytypesModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2beta1.SessionEntityTypesClient', () => { - it('has servicePath', () => { - const servicePath = sessionentitytypesModule.v2beta1.SessionEntityTypesClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = sessionentitytypesModule.v2beta1.SessionEntityTypesClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = sessionentitytypesModule.v2beta1.SessionEntityTypesClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sessionEntityTypesStub, undefined); - await client.initialize(); - assert(client.sessionEntityTypesStub); - }); - - it('has close method', () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getSessionEntityType', () => { - it('invokes getSessionEntityType without error', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()); - client.innerApiCalls.getSessionEntityType = stubSimpleCall(expectedResponse); - const [response] = await client.getSessionEntityType(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getSessionEntityType without error using callback', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()); - client.innerApiCalls.getSessionEntityType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSessionEntityType( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.ISessionEntityType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getSessionEntityType with error', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getSessionEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSessionEntityType(request), expectedError); - assert((client.innerApiCalls.getSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createSessionEntityType', () => { - it('invokes createSessionEntityType without error', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()); - client.innerApiCalls.createSessionEntityType = stubSimpleCall(expectedResponse); - const [response] = await client.createSessionEntityType(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createSessionEntityType without error using callback', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()); - client.innerApiCalls.createSessionEntityType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSessionEntityType( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.ISessionEntityType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createSessionEntityType with error', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createSessionEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSessionEntityType(request), expectedError); - assert((client.innerApiCalls.createSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateSessionEntityType', () => { - it('invokes updateSessionEntityType without error', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest()); - request.sessionEntityType = {}; - request.sessionEntityType.name = ''; - const expectedHeaderRequestParams = "session_entity_type.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()); - client.innerApiCalls.updateSessionEntityType = stubSimpleCall(expectedResponse); - const [response] = await client.updateSessionEntityType(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateSessionEntityType without error using callback', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest()); - request.sessionEntityType = {}; - request.sessionEntityType.name = ''; - const expectedHeaderRequestParams = "session_entity_type.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()); - client.innerApiCalls.updateSessionEntityType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSessionEntityType( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.ISessionEntityType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateSessionEntityType with error', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest()); - request.sessionEntityType = {}; - request.sessionEntityType.name = ''; - const expectedHeaderRequestParams = "session_entity_type.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSessionEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSessionEntityType(request), expectedError); - assert((client.innerApiCalls.updateSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteSessionEntityType', () => { - it('invokes deleteSessionEntityType without error', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteSessionEntityType = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSessionEntityType(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteSessionEntityType without error using callback', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteSessionEntityType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSessionEntityType( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteSessionEntityType with error', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSessionEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSessionEntityType(request), expectedError); - assert((client.innerApiCalls.deleteSessionEntityType as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listSessionEntityTypes', () => { - it('invokes listSessionEntityTypes without error', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), - ]; - client.innerApiCalls.listSessionEntityTypes = stubSimpleCall(expectedResponse); - const [response] = await client.listSessionEntityTypes(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSessionEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSessionEntityTypes without error using callback', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), - ]; - client.innerApiCalls.listSessionEntityTypes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSessionEntityTypes( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.ISessionEntityType[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSessionEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listSessionEntityTypes with error', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listSessionEntityTypes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSessionEntityTypes(request), expectedError); - assert((client.innerApiCalls.listSessionEntityTypes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSessionEntityTypesStream without error', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), - ]; - client.descriptors.page.listSessionEntityTypes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSessionEntityTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.SessionEntityType[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.SessionEntityType) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSessionEntityTypes, request)); - assert.strictEqual( - (client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listSessionEntityTypesStream with error', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listSessionEntityTypes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSessionEntityTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.SessionEntityType[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.SessionEntityType) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSessionEntityTypes, request)); - assert.strictEqual( - (client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSessionEntityTypes without error', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.SessionEntityType()), - ]; - client.descriptors.page.listSessionEntityTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2beta1.ISessionEntityType[] = []; - const iterable = client.listSessionEntityTypesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSessionEntityTypes with error', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listSessionEntityTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSessionEntityTypesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2beta1.ISessionEntityType[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSession', () => { - const fakePath = "/rendered/path/projectAgentSession"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionPath', () => { - const result = client.projectAgentSessionPath("projectValue", "sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionName', () => { - const result = client.matchProjectFromProjectAgentSessionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionName', () => { - const result = client.matchSessionFromProjectAgentSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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/owl-bot-staging/v2beta1/test/gapic_sessions_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_sessions_v2beta1.ts deleted file mode 100644 index 182ce86c..00000000 --- a/owl-bot-staging/v2beta1/test/gapic_sessions_v2beta1.ts +++ /dev/null @@ -1,2046 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as sessionsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubBidiStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream); -} - -describe('v2beta1.SessionsClient', () => { - it('has servicePath', () => { - const servicePath = sessionsModule.v2beta1.SessionsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = sessionsModule.v2beta1.SessionsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = sessionsModule.v2beta1.SessionsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new sessionsModule.v2beta1.SessionsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sessionsModule.v2beta1.SessionsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sessionsStub, undefined); - await client.initialize(); - assert(client.sessionsStub); - }); - - it('has close method', () => { - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('detectIntent', () => { - it('invokes detectIntent without error', async () => { - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DetectIntentRequest()); - request.session = ''; - const expectedHeaderRequestParams = "session="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DetectIntentResponse()); - client.innerApiCalls.detectIntent = stubSimpleCall(expectedResponse); - const [response] = await client.detectIntent(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.detectIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes detectIntent without error using callback', async () => { - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DetectIntentRequest()); - request.session = ''; - const expectedHeaderRequestParams = "session="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DetectIntentResponse()); - client.innerApiCalls.detectIntent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.detectIntent( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.detectIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes detectIntent with error', async () => { - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DetectIntentRequest()); - request.session = ''; - const expectedHeaderRequestParams = "session="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.detectIntent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.detectIntent(request), expectedError); - assert((client.innerApiCalls.detectIntent as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('streamingDetectIntent', () => { - it('invokes streamingDetectIntent without error', async () => { - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest()); - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse()); - client.innerApiCalls.streamingDetectIntent = stubBidiStreamingCall(expectedResponse); - const stream = client.streamingDetectIntent(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.streamingDetectIntent as SinonStub) - .getCall(0).calledWithExactly(undefined)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes streamingDetectIntent with error', async () => { - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest());const expectedError = new Error('expected'); - client.innerApiCalls.streamingDetectIntent = stubBidiStreamingCall(undefined, expectedError); - const stream = client.streamingDetectIntent(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.streamingDetectIntent as SinonStub) - .getCall(0).calledWithExactly(undefined)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); - - describe('Path templates', () => { - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSession', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSession"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionPath', () => { - const result = client.projectAgentEnvironmentUserSessionPath("projectValue", "environmentValue", "userValue", "sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSession', () => { - const fakePath = "/rendered/path/projectAgentSession"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionPath', () => { - const result = client.projectAgentSessionPath("projectValue", "sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionName', () => { - const result = client.matchProjectFromProjectAgentSessionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionName', () => { - const result = client.matchSessionFromProjectAgentSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSession', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSession"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSession', () => { - const fakePath = "/rendered/path/projectLocationAgentSession"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionPath', () => { - const result = client.projectLocationAgentSessionPath("projectValue", "locationValue", "sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v2beta1/test/gapic_versions_v2beta1.ts b/owl-bot-staging/v2beta1/test/gapic_versions_v2beta1.ts deleted file mode 100644 index 014c6027..00000000 --- a/owl-bot-staging/v2beta1/test/gapic_versions_v2beta1.ts +++ /dev/null @@ -1,2334 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as versionsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2beta1.VersionsClient', () => { - it('has servicePath', () => { - const servicePath = versionsModule.v2beta1.VersionsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = versionsModule.v2beta1.VersionsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = versionsModule.v2beta1.VersionsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new versionsModule.v2beta1.VersionsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new versionsModule.v2beta1.VersionsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.versionsStub, undefined); - await client.initialize(); - assert(client.versionsStub); - }); - - it('has close method', () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getVersion', () => { - it('invokes getVersion without error', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()); - client.innerApiCalls.getVersion = stubSimpleCall(expectedResponse); - const [response] = await client.getVersion(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getVersion without error using callback', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()); - client.innerApiCalls.getVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getVersion( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getVersion with error', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.GetVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getVersion(request), expectedError); - assert((client.innerApiCalls.getVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createVersion', () => { - it('invokes createVersion without error', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateVersionRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()); - client.innerApiCalls.createVersion = stubSimpleCall(expectedResponse); - const [response] = await client.createVersion(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createVersion without error using callback', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateVersionRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()); - client.innerApiCalls.createVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createVersion( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createVersion with error', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.CreateVersionRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createVersion(request), expectedError); - assert((client.innerApiCalls.createVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateVersion', () => { - it('invokes updateVersion without error', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateVersionRequest()); - request.version = {}; - request.version.name = ''; - const expectedHeaderRequestParams = "version.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()); - client.innerApiCalls.updateVersion = stubSimpleCall(expectedResponse); - const [response] = await client.updateVersion(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateVersion without error using callback', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateVersionRequest()); - request.version = {}; - request.version.name = ''; - const expectedHeaderRequestParams = "version.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()); - client.innerApiCalls.updateVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateVersion( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateVersion with error', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.UpdateVersionRequest()); - request.version = {}; - request.version.name = ''; - const expectedHeaderRequestParams = "version.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateVersion(request), expectedError); - assert((client.innerApiCalls.updateVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteVersion', () => { - it('invokes deleteVersion without error', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteVersion = stubSimpleCall(expectedResponse); - const [response] = await client.deleteVersion(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteVersion without error using callback', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteVersion( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteVersion with error', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.DeleteVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteVersion(request), expectedError); - assert((client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listVersions', () => { - it('invokes listVersions without error', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), - ]; - client.innerApiCalls.listVersions = stubSimpleCall(expectedResponse); - const [response] = await client.listVersions(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listVersions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listVersions without error using callback', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), - ]; - client.innerApiCalls.listVersions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listVersions( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.IVersion[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listVersions as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listVersions with error', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listVersions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listVersions(request), expectedError); - assert((client.innerApiCalls.listVersions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listVersionsStream without error', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), - ]; - client.descriptors.page.listVersions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.Version[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Version) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listVersions, request)); - assert.strictEqual( - (client.descriptors.page.listVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listVersionsStream with error', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listVersions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2beta1.Version[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.Version) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listVersions, request)); - assert.strictEqual( - (client.descriptors.page.listVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listVersions without error', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.Version()), - ]; - client.descriptors.page.listVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2beta1.IVersion[] = []; - const iterable = client.listVersionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listVersions with error', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listVersionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2beta1.IVersion[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgent', () => { - const fakePath = "/rendered/path/projectAgent"; - const expectedParameters = { - project: "projectValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentPath', () => { - const result = client.projectAgentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentName', () => { - const result = client.matchProjectFromProjectAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEntityType', () => { - const fakePath = "/rendered/path/projectAgentEntityType"; - const expectedParameters = { - project: "projectValue", - entity_type: "entityTypeValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEntityTypePath', () => { - const result = client.projectAgentEntityTypePath("projectValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironment', () => { - const fakePath = "/rendered/path/projectAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentPath', () => { - const result = client.projectAgentEnvironmentPath("projectValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectAgentEnvironmentUserSessionContextPath("projectValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectAgentEnvironmentUserSessionEntityTypePath("projectValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentFulfillment', () => { - const fakePath = "/rendered/path/projectAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentFulfillmentPath', () => { - const result = client.projectAgentFulfillmentPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentIntent', () => { - const fakePath = "/rendered/path/projectAgentIntent"; - const expectedParameters = { - project: "projectValue", - intent: "intentValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentIntentPath', () => { - const result = client.projectAgentIntentPath("projectValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentIntentName', () => { - const result = client.matchProjectFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectAgentIntentName', () => { - const result = client.matchIntentFromProjectAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionContext', () => { - const fakePath = "/rendered/path/projectAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionContextPath', () => { - const result = client.projectAgentSessionContextPath("projectValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionContextName', () => { - const result = client.matchProjectFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionContextName', () => { - const result = client.matchSessionFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectAgentSessionContextName', () => { - const result = client.matchContextFromProjectAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentSessionEntityTypePath', () => { - const result = client.projectAgentSessionEntityTypePath("projectValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAgentVersion', () => { - const fakePath = "/rendered/path/projectAgentVersion"; - const expectedParameters = { - project: "projectValue", - version: "versionValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAgentVersionPath', () => { - const result = client.projectAgentVersionPath("projectValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAgentVersionName', () => { - const result = client.matchProjectFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectAgentVersionName', () => { - const result = client.matchVersionFromProjectAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAnswerRecord', () => { - const fakePath = "/rendered/path/projectAnswerRecord"; - const expectedParameters = { - project: "projectValue", - answer_record: "answerRecordValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAnswerRecordPath', () => { - const result = client.projectAnswerRecordPath("projectValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAnswerRecordName', () => { - const result = client.matchProjectFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversation', () => { - const fakePath = "/rendered/path/projectConversation"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationPath', () => { - const result = client.projectConversationPath("projectValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationName', () => { - const result = client.matchProjectFromProjectConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationName', () => { - const result = client.matchConversationFromProjectConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationMessage', () => { - const fakePath = "/rendered/path/projectConversationMessage"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationMessagePath', () => { - const result = client.projectConversationMessagePath("projectValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationMessageName', () => { - const result = client.matchProjectFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationMessageName', () => { - const result = client.matchConversationFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectConversationMessageName', () => { - const result = client.matchMessageFromProjectConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationParticipant', () => { - const fakePath = "/rendered/path/projectConversationParticipant"; - const expectedParameters = { - project: "projectValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationParticipantPath', () => { - const result = client.projectConversationParticipantPath("projectValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationParticipantName', () => { - const result = client.matchProjectFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectConversationParticipantName', () => { - const result = client.matchConversationFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectConversationParticipantName', () => { - const result = client.matchParticipantFromProjectConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationProfile', () => { - const fakePath = "/rendered/path/projectConversationProfile"; - const expectedParameters = { - project: "projectValue", - conversation_profile: "conversationProfileValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationProfilePath', () => { - const result = client.projectConversationProfilePath("projectValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationProfileName', () => { - const result = client.matchProjectFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectKnowledgeBase', () => { - const fakePath = "/rendered/path/projectKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - 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 versionsModule.v2beta1.VersionsClient({ - 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 = { - project: "projectValue", - location: "locationValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentPath', () => { - const result = client.projectLocationAgentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentName', () => { - const result = client.matchProjectFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentName', () => { - const result = client.matchLocationFromProjectLocationAgentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - entity_type: "entityTypeValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEntityTypePath', () => { - const result = client.projectLocationAgentEntityTypePath("projectValue", "locationValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironment', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentPath', () => { - const result = client.projectLocationAgentEnvironmentPath("projectValue", "locationValue", "environmentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionContextPath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionContextPath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - environment: "environmentValue", - user: "userValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { - const result = client.projectLocationAgentEnvironmentUserSessionEntityTypePath("projectValue", "locationValue", "environmentValue", "userValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "environmentValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentFulfillment', () => { - const fakePath = "/rendered/path/projectLocationAgentFulfillment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentFulfillmentPath', () => { - const result = client.projectLocationAgentFulfillmentPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentFulfillmentName', () => { - const result = client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentIntent', () => { - const fakePath = "/rendered/path/projectLocationAgentIntent"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - intent: "intentValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentIntentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentIntentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentIntentPath', () => { - const result = client.projectLocationAgentIntentPath("projectValue", "locationValue", "intentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentIntentName', () => { - const result = client.matchProjectFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentIntentName', () => { - const result = client.matchLocationFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIntentFromProjectLocationAgentIntentName', () => { - const result = client.matchIntentFromProjectLocationAgentIntentName(fakePath); - assert.strictEqual(result, "intentValue"); - assert((client.pathTemplates.projectLocationAgentIntentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionContext', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionContext"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - context: "contextValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionContextPath', () => { - const result = client.projectLocationAgentSessionContextPath("projectValue", "locationValue", "sessionValue", "contextValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionContextName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionContextName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionContextName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchContextFromProjectLocationAgentSessionContextName', () => { - const result = client.matchContextFromProjectLocationAgentSessionContextName(fakePath); - assert.strictEqual(result, "contextValue"); - assert((client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentSessionEntityType', () => { - const fakePath = "/rendered/path/projectLocationAgentSessionEntityType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - entity_type: "entityTypeValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentSessionEntityTypePath', () => { - const result = client.projectLocationAgentSessionEntityTypePath("projectValue", "locationValue", "sessionValue", "entityTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { - const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName(fakePath); - assert.strictEqual(result, "entityTypeValue"); - assert((client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAgentVersion', () => { - const fakePath = "/rendered/path/projectLocationAgentVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - version: "versionValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAgentVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAgentVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAgentVersionPath', () => { - const result = client.projectLocationAgentVersionPath("projectValue", "locationValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAgentVersionName', () => { - const result = client.matchProjectFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAgentVersionName', () => { - const result = client.matchLocationFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationAgentVersionName', () => { - const result = client.matchVersionFromProjectLocationAgentVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationAgentVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAnswerRecord', () => { - const fakePath = "/rendered/path/projectLocationAnswerRecord"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - answer_record: "answerRecordValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAnswerRecordPath', () => { - const result = client.projectLocationAnswerRecordPath("projectValue", "locationValue", "answerRecordValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAnswerRecordName', () => { - const result = client.matchProjectFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAnswerRecordName', () => { - const result = client.matchLocationFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { - const result = client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); - assert.strictEqual(result, "answerRecordValue"); - assert((client.pathTemplates.projectLocationAnswerRecordPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversation', () => { - const fakePath = "/rendered/path/projectLocationConversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationPath', () => { - const result = client.projectLocationConversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationName', () => { - const result = client.matchProjectFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationName', () => { - const result = client.matchLocationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationName', () => { - const result = client.matchConversationFromProjectLocationConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationMessage', () => { - const fakePath = "/rendered/path/projectLocationConversationMessage"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - message: "messageValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationMessagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationMessagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationMessagePath', () => { - const result = client.projectLocationConversationMessagePath("projectValue", "locationValue", "conversationValue", "messageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationMessageName', () => { - const result = client.matchProjectFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationMessageName', () => { - const result = client.matchLocationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationMessageName', () => { - const result = client.matchConversationFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMessageFromProjectLocationConversationMessageName', () => { - const result = client.matchMessageFromProjectLocationConversationMessageName(fakePath); - assert.strictEqual(result, "messageValue"); - assert((client.pathTemplates.projectLocationConversationMessagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationParticipant', () => { - const fakePath = "/rendered/path/projectLocationConversationParticipant"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - participant: "participantValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationParticipantPath', () => { - const result = client.projectLocationConversationParticipantPath("projectValue", "locationValue", "conversationValue", "participantValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationParticipantName', () => { - const result = client.matchProjectFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationParticipantName', () => { - const result = client.matchLocationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromProjectLocationConversationParticipantName', () => { - const result = client.matchConversationFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchParticipantFromProjectLocationConversationParticipantName', () => { - const result = client.matchParticipantFromProjectLocationConversationParticipantName(fakePath); - assert.strictEqual(result, "participantValue"); - assert((client.pathTemplates.projectLocationConversationParticipantPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationProfile', () => { - const fakePath = "/rendered/path/projectLocationConversationProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_profile: "conversationProfileValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationProfilePath', () => { - const result = client.projectLocationConversationProfilePath("projectValue", "locationValue", "conversationProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationProfileName', () => { - const result = client.matchProjectFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationProfileName', () => { - const result = client.matchLocationFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationProfileFromProjectLocationConversationProfileName', () => { - const result = client.matchConversationProfileFromProjectLocationConversationProfileName(fakePath); - assert.strictEqual(result, "conversationProfileValue"); - assert((client.pathTemplates.projectLocationConversationProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationKnowledgeBase', () => { - const fakePath = "/rendered/path/projectLocationKnowledgeBase"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - knowledge_base: "knowledgeBaseValue", - }; - const client = new versionsModule.v2beta1.VersionsClient({ - 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 versionsModule.v2beta1.VersionsClient({ - 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/owl-bot-staging/v2beta1/tsconfig.json b/owl-bot-staging/v2beta1/tsconfig.json deleted file mode 100644 index c78f1c88..00000000 --- a/owl-bot-staging/v2beta1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/v2beta1/webpack.config.js b/owl-bot-staging/v2beta1/webpack.config.js deleted file mode 100644 index 0d2fc635..00000000 --- a/owl-bot-staging/v2beta1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'dialogflow', - filename: './dialogflow.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/protos/google/cloud/dialogflow/v2/audio_config.proto b/protos/google/cloud/dialogflow/v2/audio_config.proto index 6ba9c084..53803f51 100644 --- a/protos/google/cloud/dialogflow/v2/audio_config.proto +++ b/protos/google/cloud/dialogflow/v2/audio_config.proto @@ -29,6 +29,36 @@ option java_outer_classname = "AudioConfigProto"; option java_package = "com.google.cloud.dialogflow.v2"; 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 @@ -78,36 +108,6 @@ 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/protos/google/cloud/dialogflow/v2/environment.proto b/protos/google/cloud/dialogflow/v2/environment.proto index 45c0ff0f..a25e7050 100644 --- a/protos/google/cloud/dialogflow/v2/environment.proto +++ b/protos/google/cloud/dialogflow/v2/environment.proto @@ -41,7 +41,7 @@ service Environments { "https://www.googleapis.com/auth/cloud-platform," "https://www.googleapis.com/auth/dialogflow"; - // Returns the list of all non-draft environments of the specified agent. + // Returns the list of all non-default environments of the specified agent. rpc ListEnvironments(ListEnvironmentsRequest) returns (ListEnvironmentsResponse) { option (google.api.http) = { get: "/v2/{parent=projects/*/agent}/environments" @@ -79,13 +79,13 @@ service Environments { // This method allows you to deploy new agent versions into the environment. // When an environment is pointed to a new agent version by setting // `environment.agent_version`, the environment is temporarily set to the - // `LOADING` state. During that time, the environment keeps on serving the + // `LOADING` state. During that time, the environment continues serving the // previous version of the agent. After the new agent version is done loading, // the environment is set back to the `RUNNING` state. - // You can use "-" as Environment ID in environment name to update version - // in "draft" environment. WARNING: this will negate all recent changes to - // draft and can't be undone. You may want to save the draft to a version - // before calling this function. + // You can use "-" as Environment ID in environment name to update an agent + // version in the default environment. WARNING: this will negate all recent + // changes to the draft agent and can't be undone. You may want to save the + // draft agent to a version before calling this method. rpc UpdateEnvironment(UpdateEnvironmentRequest) returns (Environment) { option (google.api.http) = { patch: "/v2/{environment.name=projects/*/agent/environments/*}" @@ -164,17 +164,21 @@ message Environment { // Output only. The unique identifier of this agent environment. // Supported formats: + // // - `projects//agent/environments/` // - `projects//locations//agent/environments/` + // + // The environment ID for the default environment is `-`. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; // Optional. The developer-provided description for this environment. // The maximum length is 500 characters. If exceeded, the request is rejected. string description = 2 [(google.api.field_behavior) = OPTIONAL]; - // Required. The agent version loaded into this environment. + // Optional. The agent version loaded into this environment. // Supported formats: + // // - `projects//agent/versions/` // - `projects//locations//agent/versions/` @@ -226,6 +230,7 @@ message TextToSpeechSettings { message ListEnvironmentsRequest { // Required. The agent to list all environments from. // Format: + // // - `projects//agent` // - `projects//locations//agent` string parent = 1 [ @@ -258,9 +263,12 @@ message ListEnvironmentsResponse { message GetEnvironmentRequest { // Required. The name of the environment. // Supported formats: + // // - `projects//agent/environments/` // - `projects//locations//agent/environments/` + // + // The environment ID for the default environment is `-`. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -273,6 +281,7 @@ message GetEnvironmentRequest { message CreateEnvironmentRequest { // Required. The agent to create an environment for. // Supported formats: + // // - `projects//agent` // - `projects//locations//agent` string parent = 1 [ @@ -297,10 +306,10 @@ message UpdateEnvironmentRequest { // Required. The mask to control which fields get updated. google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; - // Optional. This field is used to prevent accidental overwrite of the draft + // Optional. This field is used to prevent accidental overwrite of the default // environment, which is an operation that cannot be undone. To confirm that // the caller desires this overwrite, this field must be explicitly set to - // true when updating the draft environment (environment ID = `-`). + // true when updating the default environment (environment ID = `-`). bool allow_load_to_draft_and_discard_changes = 3 [(google.api.field_behavior) = OPTIONAL]; } @@ -308,9 +317,12 @@ message UpdateEnvironmentRequest { message DeleteEnvironmentRequest { // Required. The name of the environment to delete. // / Format: + // // - `projects//agent/environments/` // - `projects//locations//agent/environments/` + // ID>/agent/environments/` + // + // The environment ID for the default environment is `-`. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -323,9 +335,12 @@ message DeleteEnvironmentRequest { message GetEnvironmentHistoryRequest { // Required. The name of the environment to retrieve history for. // Supported formats: + // // - `projects//agent/environments/` // - `projects//locations//agent/environments/` + // + // The environment ID for the default environment is `-`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -357,9 +372,12 @@ message EnvironmentHistory { // Output only. The name of the environment this history is for. // Supported formats: + // // - `projects//agent/environments/` // - `projects//locations//agent/environments/` + // + // The environment ID for the default environment is `-`. string parent = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The list of agent environments. There will be a maximum number of items diff --git a/protos/google/cloud/dialogflow/v2/session.proto b/protos/google/cloud/dialogflow/v2/session.proto index 2398811a..b4290f33 100644 --- a/protos/google/cloud/dialogflow/v2/session.proto +++ b/protos/google/cloud/dialogflow/v2/session.proto @@ -584,6 +584,9 @@ message StreamingRecognitionResult { // Time offset of the end of this Speech recognition result relative to the // beginning of the audio. Only populated for `message_type` = `TRANSCRIPT`. google.protobuf.Duration speech_end_offset = 8; + + // Detected language code for the transcript. + string language_code = 10; } // Represents the natural language text to be processed. diff --git a/protos/google/cloud/dialogflow/v2/version.proto b/protos/google/cloud/dialogflow/v2/version.proto index 9dd2bb2b..8e8c0011 100644 --- a/protos/google/cloud/dialogflow/v2/version.proto +++ b/protos/google/cloud/dialogflow/v2/version.proto @@ -147,6 +147,7 @@ message Version { // Output only. The unique identifier of this agent version. // Supported formats: + // // - `projects//agent/versions/` // - `projects//locations//agent/versions/` @@ -172,6 +173,7 @@ message Version { message ListVersionsRequest { // Required. The agent to list all versions from. // Supported formats: + // // - `projects//agent` // - `projects//locations//agent` string parent = 1 [ @@ -204,6 +206,7 @@ message ListVersionsResponse { message GetVersionRequest { // Required. The name of the version. // Supported formats: + // // - `projects//agent/versions/` // - `projects//locations//agent/versions/` @@ -219,6 +222,7 @@ message GetVersionRequest { message CreateVersionRequest { // Required. The agent to create a version for. // Supported formats: + // // - `projects//agent` // - `projects//locations//agent` string parent = 1 [ @@ -236,6 +240,7 @@ message CreateVersionRequest { message UpdateVersionRequest { // Required. The version to update. // Supported formats: + // // - `projects//agent/versions/` // - `projects//locations//agent/versions/` @@ -249,6 +254,7 @@ message UpdateVersionRequest { message DeleteVersionRequest { // Required. The name of the version to delete. // Supported formats: + // // - `projects//agent/versions/` // - `projects//locations//agent/versions/` diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 6ec763a0..428d6df6 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -4908,18 +4908,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 SpeechContext. */ interface ISpeechContext { @@ -5016,6 +5004,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 SpeechWordInfo. */ interface ISpeechWordInfo { @@ -6679,6 +6679,9 @@ export namespace google { /** StreamingRecognitionResult speechEndOffset */ speechEndOffset?: (google.protobuf.IDuration|null); + + /** StreamingRecognitionResult languageCode */ + languageCode?: (string|null); } /** Represents a StreamingRecognitionResult. */ @@ -6708,6 +6711,9 @@ export namespace google { /** StreamingRecognitionResult speechEndOffset. */ public speechEndOffset?: (google.protobuf.IDuration|null); + /** StreamingRecognitionResult languageCode. */ + public languageCode: string; + /** * Creates a new StreamingRecognitionResult instance using the specified properties. * @param [properties] Properties to set diff --git a/protos/protos.js b/protos/protos.js index 2773ef4f..fe5ade12 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -11697,32 +11697,6 @@ return MessageAnnotation; })(); - /** - * AudioEncoding enum. - * @name google.cloud.dialogflow.v2.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 - */ - v2.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; - })(); - v2.SpeechContext = (function() { /** @@ -11949,6 +11923,32 @@ return SpeechContext; })(); + /** + * AudioEncoding enum. + * @name google.cloud.dialogflow.v2.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 + */ + v2.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; + })(); + v2.SpeechWordInfo = (function() { /** @@ -16492,6 +16492,7 @@ * @property {number|null} [confidence] StreamingRecognitionResult confidence * @property {Array.|null} [speechWordInfo] StreamingRecognitionResult speechWordInfo * @property {google.protobuf.IDuration|null} [speechEndOffset] StreamingRecognitionResult speechEndOffset + * @property {string|null} [languageCode] StreamingRecognitionResult languageCode */ /** @@ -16558,6 +16559,14 @@ */ StreamingRecognitionResult.prototype.speechEndOffset = null; + /** + * StreamingRecognitionResult languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.languageCode = ""; + /** * Creates a new StreamingRecognitionResult instance using the specified properties. * @function create @@ -16595,6 +16604,8 @@ $root.google.cloud.dialogflow.v2.SpeechWordInfo.encode(message.speechWordInfo[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); if (message.speechEndOffset != null && Object.hasOwnProperty.call(message, "speechEndOffset")) $root.google.protobuf.Duration.encode(message.speechEndOffset, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.languageCode); return writer; }; @@ -16649,6 +16660,9 @@ case 8: message.speechEndOffset = $root.google.protobuf.Duration.decode(reader, reader.uint32()); break; + case 10: + message.languageCode = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -16716,6 +16730,9 @@ if (error) return "speechEndOffset." + error; } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; return null; }; @@ -16766,6 +16783,8 @@ throw TypeError(".google.cloud.dialogflow.v2.StreamingRecognitionResult.speechEndOffset: object expected"); message.speechEndOffset = $root.google.protobuf.Duration.fromObject(object.speechEndOffset); } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); return message; }; @@ -16790,6 +16809,7 @@ object.isFinal = false; object.confidence = 0; object.speechEndOffset = null; + object.languageCode = ""; } if (message.messageType != null && message.hasOwnProperty("messageType")) object.messageType = options.enums === String ? $root.google.cloud.dialogflow.v2.StreamingRecognitionResult.MessageType[message.messageType] : message.messageType; @@ -16806,6 +16826,8 @@ } if (message.speechEndOffset != null && message.hasOwnProperty("speechEndOffset")) object.speechEndOffset = $root.google.protobuf.Duration.toObject(message.speechEndOffset, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; return object; }; diff --git a/protos/protos.json b/protos/protos.json index e131f318..05024529 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -1576,18 +1576,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 - } - }, "SpeechContext": { "fields": { "phrases": { @@ -1601,6 +1589,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 + } + }, "SpeechWordInfo": { "fields": { "word": { @@ -2102,6 +2102,10 @@ "speechEndOffset": { "type": "google.protobuf.Duration", "id": 8 + }, + "languageCode": { + "type": "string", + "id": 10 } }, "nested": { diff --git a/src/v2/environments_client.ts b/src/v2/environments_client.ts index 1c37f1f0..9d1fbd5f 100644 --- a/src/v2/environments_client.ts +++ b/src/v2/environments_client.ts @@ -478,9 +478,12 @@ export class EnvironmentsClient { * @param {string} request.name * Required. The name of the environment. * Supported formats: + * * - `projects//agent/environments/` * - `projects//locations//agent/environments/` + * + * The environment ID for the default environment is `-`. * @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. @@ -573,6 +576,7 @@ export class EnvironmentsClient { * @param {string} request.parent * Required. The agent to create an environment for. * Supported formats: + * * - `projects//agent` * - `projects//locations//agent` * @param {google.cloud.dialogflow.v2.Environment} request.environment @@ -669,13 +673,13 @@ export class EnvironmentsClient { * This method allows you to deploy new agent versions into the environment. * When an environment is pointed to a new agent version by setting * `environment.agent_version`, the environment is temporarily set to the - * `LOADING` state. During that time, the environment keeps on serving the + * `LOADING` state. During that time, the environment continues serving the * previous version of the agent. After the new agent version is done loading, * the environment is set back to the `RUNNING` state. - * You can use "-" as Environment ID in environment name to update version - * in "draft" environment. WARNING: this will negate all recent changes to - * draft and can't be undone. You may want to save the draft to a version - * before calling this function. + * You can use "-" as Environment ID in environment name to update an agent + * version in the default environment. WARNING: this will negate all recent + * changes to the draft agent and can't be undone. You may want to save the + * draft agent to a version before calling this method. * * @param {Object} request * The request object that will be sent. @@ -684,10 +688,10 @@ export class EnvironmentsClient { * @param {google.protobuf.FieldMask} request.updateMask * Required. The mask to control which fields get updated. * @param {boolean} [request.allowLoadToDraftAndDiscardChanges] - * Optional. This field is used to prevent accidental overwrite of the draft + * Optional. This field is used to prevent accidental overwrite of the default * environment, which is an operation that cannot be undone. To confirm that * the caller desires this overwrite, this field must be explicitly set to - * true when updating the draft environment (environment ID = `-`). + * true when updating the default environment (environment ID = `-`). * @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. @@ -780,9 +784,12 @@ export class EnvironmentsClient { * @param {string} request.name * Required. The name of the environment to delete. * / Format: + * * - `projects//agent/environments/` * - `projects//locations//agent/environments/` + * ID>/agent/environments/` + * + * The environment ID for the default environment is `-`. * @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. @@ -869,13 +876,14 @@ export class EnvironmentsClient { > ): void; /** - * Returns the list of all non-draft environments of the specified agent. + * Returns the list of all non-default environments of the specified agent. * * @param {Object} request * The request object that will be sent. * @param {string} request.parent * Required. The agent to list all environments from. * Format: + * * - `projects//agent` * - `projects//locations//agent` * @param {number} [request.pageSize] @@ -947,6 +955,7 @@ export class EnvironmentsClient { * @param {string} request.parent * Required. The agent to list all environments from. * Format: + * * - `projects//agent` * - `projects//locations//agent` * @param {number} [request.pageSize] @@ -996,6 +1005,7 @@ export class EnvironmentsClient { * @param {string} request.parent * Required. The agent to list all environments from. * Format: + * * - `projects//agent` * - `projects//locations//agent` * @param {number} [request.pageSize] @@ -1075,9 +1085,12 @@ export class EnvironmentsClient { * @param {string} request.parent * Required. The name of the environment to retrieve history for. * Supported formats: + * * - `projects//agent/environments/` * - `projects//locations//agent/environments/` + * + * The environment ID for the default environment is `-`. * @param {number} [request.pageSize] * Optional. The maximum number of items to return in a single page. By default 100 and * at most 1000. @@ -1145,9 +1158,12 @@ export class EnvironmentsClient { * @param {string} request.parent * Required. The name of the environment to retrieve history for. * Supported formats: + * * - `projects//agent/environments/` * - `projects//locations//agent/environments/` + * + * The environment ID for the default environment is `-`. * @param {number} [request.pageSize] * Optional. The maximum number of items to return in a single page. By default 100 and * at most 1000. @@ -1195,9 +1211,12 @@ export class EnvironmentsClient { * @param {string} request.parent * Required. The name of the environment to retrieve history for. * Supported formats: + * * - `projects//agent/environments/` * - `projects//locations//agent/environments/` + * + * The environment ID for the default environment is `-`. * @param {number} [request.pageSize] * Optional. The maximum number of items to return in a single page. By default 100 and * at most 1000. diff --git a/src/v2/versions_client.ts b/src/v2/versions_client.ts index d7c1528b..7822e5c3 100644 --- a/src/v2/versions_client.ts +++ b/src/v2/versions_client.ts @@ -468,6 +468,7 @@ export class VersionsClient { * @param {string} request.name * Required. The name of the version. * Supported formats: + * * - `projects//agent/versions/` * - `projects//locations//agent/versions/` @@ -563,6 +564,7 @@ export class VersionsClient { * @param {string} request.parent * Required. The agent to create a version for. * Supported formats: + * * - `projects//agent` * - `projects//locations//agent` * @param {google.cloud.dialogflow.v2.Version} request.version @@ -663,6 +665,7 @@ export class VersionsClient { * @param {google.cloud.dialogflow.v2.Version} request.version * Required. The version to update. * Supported formats: + * * - `projects//agent/versions/` * - `projects//locations//agent/versions/` @@ -760,6 +763,7 @@ export class VersionsClient { * @param {string} request.name * Required. The name of the version to delete. * Supported formats: + * * - `projects//agent/versions/` * - `projects//locations//agent/versions/` @@ -856,6 +860,7 @@ export class VersionsClient { * @param {string} request.parent * Required. The agent to list all versions from. * Supported formats: + * * - `projects//agent` * - `projects//locations//agent` * @param {number} [request.pageSize] @@ -927,6 +932,7 @@ export class VersionsClient { * @param {string} request.parent * Required. The agent to list all versions from. * Supported formats: + * * - `projects//agent` * - `projects//locations//agent` * @param {number} [request.pageSize] @@ -976,6 +982,7 @@ export class VersionsClient { * @param {string} request.parent * Required. The agent to list all versions from. * Supported formats: + * * - `projects//agent` * - `projects//locations//agent` * @param {number} [request.pageSize]